【发布时间】:2016-01-22 23:44:25
【问题描述】:
在 pom.xml 中
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testing.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
在 testing.xml 中
<suite name="Suite1" verbose="1">
<test name="Regression1" parallel="false" preserve-order="true">
<packages>
<package name="apps.sample.test1.*" />
<package name="apps.sample.test2.*" />
</packages>
<classes>
<class name="apps.sample.test1.Test1.java" />
<class name="apps.sample.test1.Test2.java" />
</classes>
</test>
</suite>
apps.sample.test1.* 包含以下内容 1.apps.sample.test1.Test1.java
@BeforeClass
public void test1(Method method) throws Exception {
}
@Test(priority=1)
public void test2(Method method) throws Exception {
}
@Test(priority=2)
public void test3(Method method) throws Exception {
}
@Test(priority=3)
public void test4(Method method) throws Exception {
}
当我运行 testing.xml 时,所有 Class 文件中的所有 @BeforeClass 都首先执行,然后从所有类中执行 @Test(priority=1) 方法一个接一个地执行。
由于上述情况,我的所有类文件中的 @Test(priority=2) 都失败了。
如何让我的测试根据每个类的优先级顺序执行,并且类应该一个一个地执行?
【问题讨论】:
标签: java android maven testng appium