【问题标题】:How do I do Maven to run tests using the features ordering?Maven 如何使用功能排序运行测试?
【发布时间】:2016-11-21 11:29:55
【问题描述】:

我正在使用套件 Maven + Selenium + Jenkins 运行电子商务应用程序的集成测试。

碰巧Maven 不遵循 .feature 文件顺序:

1-test_case.feature 
2-test_case.feature 
3-test_case.feature 

Maven 遵循的顺序是:

RunOneTest.class / 2.test_case.feature
RunTwoTest.class / 3.test_case.feature
RunThreeTest.class / 1.test_case.feature

我已经尝试更改 pom.xml 文件中的 runOrder 参数,没有成功。

 <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <configuration>
     <runOrder>filesystem</runOrder>
     </configuration>
 </plugin>

【问题讨论】:

  • 你检查了哪些所有runorder参数?
  • 我尝试了“字母”、“平衡”和“文件系统”

标签: java maven selenium jenkins automated-tests


【解决方案1】:

我找到了一种方法:消除各种 runners,让 一个 runner 来执行“.feature”文件。

新结构:

src
|- main
|-- java
|--- com.companyname.project
|---- AnotherTestcasePO.java
|---- OtherTestcasePO.java
|---- SomeTestcasePO.java
|--- utils
|---- Project
|- test
|-- java
|--- com.companyname.project
|---- runner
|----- RunYourTest.java
|---- steps
|----- TestcaseSteps.java
testCases
|- 1-SomefeatureFirst.feature
|- 2-OtherfeatureSecond.feature
|- 3-AnotherfeatureThird.feature

在我的具体项目中,我将测试用例文件夹位置更改为项目的根目录,但这并不影响执行。

参考:How to pass multiple parameter to cucumber runner file from Jenkins.

【讨论】:

    猜你喜欢
    • 2019-03-30
    • 2015-09-26
    • 2012-02-11
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多