Java 覆盖或聚合teamcity中的测试结果
我有teamcity工作,分为两步:Java 覆盖或聚合teamcity中的测试结果,java,testng,teamcity,Java,Testng,Teamcity,我有teamcity工作,分为两步: 1.执行测试。 2.重新运行失败。 我们在步骤1中有3个测试失败,重新运行后只有1个测试失败 Teamcity生成的报告中有4个测试失败,而不是1个。如何用“通过”状态覆盖步骤1中失败的测试结果 编辑 例如,我的套件如下所示: <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Suite 1" thread-count="5" parallel=
1.执行测试。
2.重新运行失败。
我们在步骤1中有3个测试失败,重新运行后只有1个测试失败 Teamcity生成的报告中有4个测试失败,而不是1个。如何用“通过”状态覆盖步骤1中失败的测试结果 编辑 例如,我的套件如下所示:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite 1" thread-count="5" parallel="methods">
<test name="Test 1">
<classes>
<class name="unittest.TestNGTest"/>
</classes>
</test>
</suite>
运行后,我的代码生成我重新运行测试套件,teamcity在第二步中运行此套件:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite 1" thread-count="1" parallel="methods">
<test name="Test 1">
<parameter name="indicies" value = "0:1"/> <-- that means that i want rerun only first and second dataprovider configuration -->
<classes>
<class name="unittest.TestNGTest">
<include name = testM1/>
</class>
</classes>
</test>
<test name="Test 2">
<parameter name="indicies" value = "6"/> <-- that means that i want rerun only seventh dataprovider configuration -->
<classes>
<class name="unittest.TestNGTest">
<include name = testM2/>
</class>
</classes>
</test>
</suite>
正如您所见,我仅在一个线程中使用相应的dataprovider配置重新运行失败的测试用例,有三种方法可以解决此问题
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite 1" data-provider-thread-count="10" parallel="methods">
<test name="Test 1">
<classes>
<class name="unittest.TestNGTest"/>
</classes>
</test>
</suite>
输出:
15 beforeMethod
16 beforeMethod
16 test 2
18 beforeMethod
18 test 2
17 beforeMethod
Test ignored.
16 afterMethod
16 beforeMethod
16 test 2
Test ignored.
16 afterMethod
16 beforeMethod
16 test 2
Test ignored.
16 afterMethod
16 beforeMethod
16 test 2
16 afterMethod
15 test 1
Test ignored.
17 test 1
17 afterMethod
15 afterMethod
15 beforeMethod
18 afterMethod
15 test 1
Test ignored.
15 afterMethod
15 beforeMethod
15 test 1
Test ignored.
15 afterMethod
15 beforeMethod
15 test 1
15 afterMethod
我已经创建了一个最小的代码来演示重试是如何工作的。正如在这段代码中所演示的,失败的数据点在同一个线程中运行,该线程产生了原始测试方法,并向其提供了数据点。此外,正如您所看到的,当它重试运行失败的方法时,它还会重新运行配置方法。有三种方法可以解决此问题
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite 1" data-provider-thread-count="10" parallel="methods">
<test name="Test 1">
<classes>
<class name="unittest.TestNGTest"/>
</classes>
</test>
</suite>
输出:
15 beforeMethod
16 beforeMethod
16 test 2
18 beforeMethod
18 test 2
17 beforeMethod
Test ignored.
16 afterMethod
16 beforeMethod
16 test 2
Test ignored.
16 afterMethod
16 beforeMethod
16 test 2
Test ignored.
16 afterMethod
16 beforeMethod
16 test 2
16 afterMethod
15 test 1
Test ignored.
17 test 1
17 afterMethod
15 afterMethod
15 beforeMethod
18 afterMethod
15 test 1
Test ignored.
15 afterMethod
15 beforeMethod
15 test 1
Test ignored.
15 afterMethod
15 beforeMethod
15 test 1
15 afterMethod
我已经创建了一个最小的代码来演示重试是如何工作的。正如在这段代码中所演示的,失败的数据点在同一个线程中运行,该线程产生了原始测试方法,并向其提供了数据点。此外,正如您所看到的,在重试运行失败的方法时,它还会重新运行配置方法。谢谢,我使用的是testng,但我不能使用IRetry,因为我需要具有不同参数的run suite。此外,我可以在何处以及如何排除重复的测试结果?@AlexKvasko IRetryAnalyzer只会使用原始测试中通过的参数进行失败的测试,这意味着如果使用其他测试数据/参数运行同一测试,IRetry将使用提供的参数运行。如果你能在你的帖子中发布一个最小的可复制代码,并告诉我为什么IRetry不能工作,那么我可以更好地指导你我有大约50个数据提供程序配置的测试用例,所以如果我将重新运行我的用例,那么所有50个配置都将重新运行。我想在一个线程中重新运行我的测试用例,以最大限度地提高稳定性。所以我在5-6个线程中运行了很多测试用例,每个测试用例有10到50个数据提供程序集。我只想在1个线程中重新运行失败的数据提供程序集(不是每个案例中的所有数据)。我已经创建了解析器,它使用