简体   繁体   中英

How do I do Maven to run tests using the features ordering?

I'm using the suite Maven + Selenium + Jenkins to run integration tests with a e-commerce application.

It happens that Maven doesn't follow the .feature files order:

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

The order that Maven follows is:

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

I already tried changing the runOrder parameter in pom.xml file, no success.

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

I found a way to do this: eliminating the various runners , letting just one runner to execute " .feature " files.

The new structure:

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

In my specific project, I changed the test cases folder location to the root of project, but this doesn't affect the execution.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM