简体   繁体   中英

Running Testng.xml from POM.xml is not running tests in sequence

I am running testng.xml file using POM.xml by adding compiler and surefire plugins. It runs test but the sequence of tests is not as expected. I have 10 classes mentioned in testng.xml and it runs in that sequence when i run through testng.xml.But when running through POM.xml the sequence goes like; first it runs all the 0 priority tests mentioned in all classes, then 1 priority tests and so on. It should run tests according to the classes sequence mentioned in testng.xml. Any quick help will be much appreciated.

   <build>
   <plugins>
    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
    <version>3.5.1</version>
    <configuration>
        <source>${jdk.level}</source>
        <target>${jdk.level}</target>  
        
    </configuration>
  </plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M5</version>
    <configuration>
      <suiteXmlFiles>
        <suiteXmlFile>testng.xml</suiteXmlFile>
      </suiteXmlFiles>
    </configuration>
  </plugin>

 </plugins>

 </build>

under testng dependency the scope tag needed to be changed to compile from test and it resolved the issue as it needed to compile the build after adding plugins. It resolved the issue.

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