我在appium项目的test-output目录中获得了一个testng-results.xml文件。在里面我得到我的测试结果,例如:
<test-method status="PASS" signature="setBeforeEachTest()[pri:0, instance:appium.salesforce1.ios.tests.MyTests]" name="setBeforeEachTest" is-config="true" duration-ms="0" started-at="2016-02-10T14:26:59Z" finished-at="2016-02-10T14:26:59Z">
<reporter-output>
</reporter-output>
</test-method>
我希望我的test-method标签输出如下:
<test-method build="testBuild" status="PASS" signature="setBeforeEachTest()[pri:0, instance:appium.salesforce1.ios.tests.MyTests]" name="setBeforeEachTest" is-config="true" duration-ms="0" started-at="2016-02-10T14:26:59Z" finished-at="2016-02-10T14:26:59Z">
<reporter-output>
</reporter-output>
</test-method>
基本上,我想为test-method标签添加另一个值。我试过在@Test
中做这个ITestResult result = Reporter.getCurrentTestResult();
result.setAttribute("build", "testBuild");
但这不起作用。有什么想法吗?