-
-
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.
[TestNG] Add README.md with usage instructions
- Loading branch information
1 parent
51d87cb
commit d2e4f5c
Showing
1 changed file
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Cucumber TestNG | ||
============== | ||
|
||
Use TestNG to execute cucumber scenarios. | ||
|
||
Add the `cucumber-testng` dependency to your pom. | ||
|
||
```xml | ||
<dependencies> | ||
[...] | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-testng</artifactId> | ||
<version>${cucumber.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
[...] | ||
</dependencies> | ||
``` | ||
|
||
Create an empty class that extends the `AbstractTestNGCucumberTests`. | ||
|
||
```java | ||
package cucumber.runtime.testng; | ||
|
||
import cucumber.api.CucumberOptions; | ||
import cucumber.api.testng.AbstractTestNGCucumberTests; | ||
|
||
@CucumberOptions(plugin = "json:target/cucumber-report.json") | ||
public class RunCukesTest extends AbstractTestNGCucumberTests { | ||
} | ||
``` | ||
|
||
This will execute all scenarios in same package as the runner, by default glue code is also assumed to be in the same | ||
package. The `@CucumberOptions` can be used to provide | ||
[additional configuration](https://cucumber.io/docs/reference/jvm#list-configuration-options) to the runner. | ||
|
||
|
||
## Test composition ## | ||
|
||
It is possible to use TestNG without inheriting from `AbstractTestNGCucumberTests` by using the `TestNGCucumberRunner`. | ||
See the [RunCukesByCompositionTest Example](../examples/java-calculator-testng/src/test/java/cucumber/examples/java/calculator/RunCukesByCompositionTest.java) | ||
for usage. |