Skip to content

Commit

Permalink
[TestNG] Add README.md with usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkorstanje committed Apr 1, 2018
1 parent 51d87cb commit d2e4f5c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions testng/README.md
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.

0 comments on commit d2e4f5c

Please sign in to comment.