I cloned the cucumber-jvm project and ran example java-calculator-testng. The resulting testNg report displays two test suites.
The first suite is named "cucumber.examples.java.calculator.RunCukesTest" and contains one test called "run_cukes".
The second suite is named "cucumber.examples.java.calculator.RunCukesByCompositionTest" and contains one test called "runCukes".
I want to duplicate this in my own project. I mean I want to have a single testNg report that shows two test suites. One test suite that inherits from AbstractTestNGCucumberTests and another test suite that does not.
I created my project with the same dependencies and file structure as the java-calculator-testng example. I also put my classes in the same package like the java-calculator-example.
The problem is that my testNg report shows only one test suite named "Command line suite" that contains one test named "Command line test" that has two classes.
Why are my test classes combined into the same test suite instead of separate suites like the example?
Also, why is my test suite named "Command line suite"
Here is how I attempt to duplicate the java-calculator-testng example:
RunCukesTest.java
// RunCukesTest.java
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
@CucumberOptions(format = "json:target/cucumber-report.json")
public class RunCukesTest extends AbstractTestNGCucumberTests {
}
RunCukesByCompositionTest.java
// RunCukesByCompositionTest.java
import cucumber.api.CucumberOptions;
import cucumber.api.testng.TestNGCucumberRunner;
import org.testng.annotations.Test;
@CucumberOptions(format = "json:target/cucumber-report-composite.json")
public class RunCukesByCompositionTest extends RunCukesByCompositionBase {
@Test(groups = "examples-testng", description = "Example of using TestNGCucumberRunner to invoke Cucumber")
public void runCukes() {
new TestNGCucumberRunner(getClass()).runCukes();
}
}
RunCukesByCompositionBase.java
// RunCukesByCompositionBase
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
class RunCukesByCompositionBase {
@BeforeClass
public void beforeClass() {
// do expensive setup
System.out.println("[Base] @BeforeClass");
}
@BeforeMethod
public void beforeMethod() {
// do expensive setup
System.out.println("[Base] @BeforeMethod");
}
}