-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Karate runner argument ignore no scenarios assertion
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: #2531
- Loading branch information
dustin
committed
Mar 13, 2024
1 parent
3f8477e
commit 74d94ca
Showing
5 changed files
with
44 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
karate-junit5/src/test/java/karate/NoFeatureNoScenarioTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package karate; | ||
|
||
import com.intuit.karate.junit5.Karate; | ||
|
||
class NoFeatureNoScenarioTest { | ||
|
||
@Karate.Test | ||
Karate testValidTagWithIgnoreJunitNoScenarioAssertion() { | ||
return Karate.run("noFeatureNoScenario") | ||
.tags("@smoke") | ||
.ignoreJunitNoScenariosAssertion(true) | ||
.relativeTo(getClass()); | ||
} | ||
@Karate.Test | ||
Karate testInvalidTagWithIgnoreJunitNoScenarioAssertion() { | ||
return Karate.run("noFeatureNoScenario") | ||
.tags("@tagnotexist") | ||
.ignoreJunitNoScenariosAssertion(true) | ||
.relativeTo(getClass()); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
karate-junit5/src/test/java/karate/noFeatureNoScenario.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Feature: ignoreJunitNoScenariosAssertion argument for Karate runner | ||
|
||
@smoke | ||
Scenario: smoke | ||
* print 'smoke' |