【发布时间】:2019-01-28 21:18:31
【问题描述】:
当我运行以下命令时:
mvn test -Dcucumber.options="--tags @UserAuthentication"
然后我得到以下错误:
Unknown lifecycle phase
".options=src/test/java/Feature --tags @@UserAuthentication".
You must specify a valid lifecycle phase or a goal in the format
<plugin-prefix>:<goal> or
<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>
我的 POM 文件如下:
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.test.org 测试 0.0.1-快照
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M3</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> </plugins> </pluginManagement> </build> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.7.1</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-java</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-jvm-deps</artifactId> <version>1.0.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-junit</artifactId> <version>1.2.5</version> <scope>test</scope> </dependency> <dependency> <groupId>com.vimalselvam</groupId> <artifactId>cucumber-extentsreport</artifactId> <version>3.0.2</version> </dependency> <dependency> <groupId>com.aventstack</groupId> <artifactId>extentreports</artifactId> <version>3.1.2</version> </dependency> </dependencies> </project>
我的跑步者班级如下:
@RunWith(Cucumber.class)
@CucumberOptions(
features ="src/test/java/Feature",
glue= "stepDefinitions",
tags= {"@Pagination,@UserAuthentication"},
plugin = { "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"},
monochrome = true)
public class RunnerTest {
@AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File("config/report.xml"));
}
}
我不知道使用标签从命令行运行测试的目标是什么。
【问题讨论】:
-
你找到解决方案了吗?
标签: java maven selenium-webdriver junit cucumber