Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Karate configuration option to disable the "no features or scenarios found" assertion #2531

Open
dustinsand opened this issue Mar 11, 2024 · 1 comment
Assignees
Milestone

Comments

@dustinsand
Copy link

dustinsand commented Mar 11, 2024

If JUnit 5 is used to run a Karate feature file, but no scenarios are found that match the run criteria, this error is thrown:

no features or scenarios found: [classpath:karate/features/helloworld/]

For example, if Karate is run with these arguments and this feature file, the error will be thrown.

-Dkarate.options="--tags @smoke"

Feature: Hello World
@prod
Scenario: Hello to the world

The workaround is to add a scenario that does nothing, for example,

Feature: Hello World
@prod
Scenario: Hello to the world

@smoke
Scenario: Do Nothing

Opened this issue to start a discussion for adding a Karate configuration option to disable this error in com.intuit.karate.junit5.Karate.java.

@ptrthomas
Copy link
Member

@dustinsand I do agree that throwing this error may be un-necessary - the original intent was in case user got the path wrong, the IDE would show a green bar even if zero tests were run. I'm ok to accept a PR to change this

@dustinsand dustinsand changed the title Add Karate configuration option to disable the "no features or scenarios found" error Add Karate configuration option to disable the "no features or scenarios found" assertion Mar 12, 2024
dustinsand pushed a commit to dustinsand/karate that referenced this issue Mar 13, 2024
If JUnit 5 is used to run a Karate feature file, but no scenarios are found that match the run criteria, this error is thrown:

    no features or scenarios found: [classpath:karate/features/helloworld/]

For example, if Karate is run with these arguments and this feature file, the error will be thrown.

-Dkarate.options="--tags @smoke"

Feature: Hello World
@prod
Scenario: Hello to the world

Refs: karatelabs#2531
dustinsand pushed a commit to dustinsand/karate that referenced this issue Mar 13, 2024
Renamed ignoreJunitNoScenariosAssertion to failWhenNoScenariosFound.

Refs: karatelabs#2531
@ptrthomas ptrthomas added this to the 1.5.0 milestone Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants