问题
I have a file with file extension .feature
. HOw do run this from the command line?
In order to make a batch file for each feature. I am using Cucumber-JVM with Java and Selenium.
回答1:
Cucumber-JVM is based on JUnit so its just like running any unit tests from the command line
java -cp /path/to/junit.jar org.junit.runner.JUnitCore [test class name]
where test class name
is annotated with @CucumberOptions whose features
refer to the feature file. If youre using Maven you could use
mvn test
回答2:
If you are using Maven, you can run your .feature
file this way:
mvn -Dcucumber.options="from/the/root/of/module/to/the/feature/MyFeature.feature" test
This will override the @CucumberOptions
in the test runner class.
来源:https://stackoverflow.com/questions/23324507/how-to-run-a-cucumber-jvm-feature-file-from-the-command-line