gpt4 book ai didi

java - surefire插件中的maven多个测试服

转载 作者:搜寻专家 更新时间:2023-11-01 03:10:30 25 4
gpt4 key购买 nike

我正在使用带有 surefire 插件的 TestNg 和 Maven 来运行我的测试。我有几个不同的测试想在同一个 pom 中运行。目前要执行此操作,我定义了两个不同的 XML 文件,并且定义了两个配置文件来运行不同的 xml 文件,但这会不断抛出错误!

我不知道该如何解决这个问题。任何帮助将不胜感激!

 <profile>
<id>run</id>
<activation>
<property>
<name>start</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<suiteXmlFiles>
<suiteXmlFile>${project.build.directory}/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>

</configuration>
<executions>
<execution>
<id>test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

假设配置文件 2 几乎相同,但 xml 套件文件不同

我收到一个解析错误:在 suiteXmlFile 中找不到测试类。但是,如果我只使用一个配置文件只有一个 xml 文件,这是可以接受的。失败的那个也有效。

最佳答案

尝试将suiteXmlFiles移动到执行配置中,使用更适合集成测试的maven-failsafe-plugin

关于java - surefire插件中的maven多个测试服,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11626171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com