Reputation: 11
when i run cucumber tests using "Run as Junit Tests", the tests runs properly with proper tags.
also when i run cucumber tests using "Maven", the tests runs properly with proper tags,provided i have mentioned the tags in runner class.
@Cucumber.Options(format={"pretty", html:target/cucumber","json:target/cucumber.json"},tags= {"@smokeTest"})
But i want to be able to provide tags as argument to mvn test command,to run the test cases and i am making use of following command.
mvn test -Dcucumber.options="--tags @tagTest"
But it runs all the test cases irrespective of my tags.
also when i use the command mvn test -Dcucumber.options="--tags @tagTest"
i mention no tags in my runner class
@Cucumber.Options(format={"pretty",html:target/cucumber","json:target/cucumber.json"})
Please let me know where am i going wrong anywhere?
This is runnerTest code:
import org.junit.runner.RunWith;
import cucumber.junit.Cucumber;
@RunWith(Cucumber.class)
@Cucumber.Options(format={"pretty", "html:target/cucumber","json:target/cucumber.json"})
public class runnerTest {
}
Attached
Upvotes: 0
Views: 2243
Reputation: 724
The first issue is that the maven command is not compatible with the version of cucumber. The argument "cucumber.options" was introduced in version 1.1.1 (please see this thread) but the POM shows an older version. The correct maven command for that feature on that specific cucumber version should be:
mvn test -Dtags=@tagTest
But the second issue is that there seems to be a bug with that feature which was not fixed at all until version 1.1.1, which is when the new argument was also introduced.
So the solution seems to be to upgrade to version 1.1.1+ of cucumber.
Upvotes: 1