从POM.xml运行Testng.xml不是按顺序运行测试



我通过添加编译器和surefire插件,使用POM.xml运行testng.xml文件。它运行测试,但测试的顺序并不像预期的那样。我在testng.xml中提到了10个类,当我运行testng.xml时,它会按这个顺序运行;首先,它运行所有类中提到的所有0优先级测试,然后运行1优先级测试,依此类推。它应该根据testng.xml中提到的类序列运行测试。任何快速的帮助都将不胜感激。

<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>

在testng依赖项下,需要将scope标记更改为从测试编译,它解决了添加插件后编译构建所需的问题。它解决了这个问题。

最新更新