【发布时间】:2019-05-06 21:08:55
【问题描述】:
如何通过 maven 命令行将测试用例传递给 geb:
我有一个名为 GebishOrgSpec2.groovy 的测试用例类 我想通过这个测试用例 maven 并让 geb 在命令行上运行它。 我正在成功构建但没有运行测试用例 我该如何解决这个问题?
这是我的 pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<includes>
<include>${inc.TestCase}</include>
</includes>
<systemPropertyVariables>
<geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
</systemPropertyVariables>
</configuration>
</plugin>
我尝试了以下代码,但它们都没有运行测试用例
mvn -Dinc.TestCase=GebishOrgSpec2.groovy test
mvn -Dinclude=GebishOrgSpec2.groovy test
mvn install -Dinc.TestCase=GebishOrgSpec2.groovy
mvn install -Dinclude=GebishOrgSpec2.groovy
我已经尝试过这些链接 How to run Geb TestCases from windows command line?
Grails geb getting parameters from commandline
Geb exception when running tests in maven
他们都没有工作
System.getProperty("inc.TestCase") 也返回 null 我想补充一点,如果我将测试用例直接添加到 pom 中,它确实运行成功 你能帮忙吗
【问题讨论】:
-
感谢您对我的回答提供反馈。我花时间为您测试和编写它,并添加指向文档网站的链接。
-
@kriegaex 我想首先为我的反馈延迟表示歉意。我试图传递其他不起作用的用户定义变量,这让我的注意力转移了。请我恳求你接受我的道歉。
标签: maven testing groovy command-line geb