I would like to package my acceptance tests into an executable JAR where all necessary libraries are included for running the tests and generating the reports. I would also like to either run all tests or a single test.
So far, I'm able to run all tests and although reports are being generated in the location I specified in serenity.properties, the index.html is NOT being generated.
Normally, I would run my tests using maven verify goal which would run the serenity-maven-plugin, but since I'm running from a JAR, I'm not sure how I can achieve the same thing.
I have a main class that looks as follows:
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "classpath:com/cfhayes/test/LookupADefinition.feature")
public class DefinitionTestSuite {
public static void main(String[] args) throws Exception {
JUnitCore.main("com.cfhayes.test.DefinitionTestSuite");
}
}
And my feature file uses tags so that I can specify a single scenario to run:
Feature: Lookup a definition
@TEST-0001
Scenario: Looking up the definition of 'apple'
Given the user is on the Wikionary home page
When the user looks up the definition of the word 'apple'
Then they should see the definition 'A common, round fruit produced by the tree Malus domestica, cultivated in temperate climates.'
@TEST-0002
Scenario: Looking up the definition of 'pear'
Given the user is on the Wikionary home page
When the user looks up the definition of the word 'pear'
Then they should see the definition 'An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.'
I'm hoping there is a way I can use JVM args with the executable JAR that would somehow allow me to set the cucumber options. I tried doing something like this:
java -jar my-test-jar.jar -Dcucumber.options="--tags @TEST-0001"
...but that still runs ALL tests.
Any ideas would be greatly appreciated.