如何在testNg中运行套件后重新运行失败的测试用例

时间:2017-06-27 12:20:59

标签: java selenium testng

下面是testNg.xml中的测试用例

`<test name="Subset_TC01">
        <parameter name="InputExcelPath" value="Subset_TC01.xls" />
        <classes>
            <class name="com.idp.testcases.nbp.Mainflow">
                <methods>
                    <include name="testLogin" />
                    <include name="testLandingPage" />
                    <include name="testSearch" />
                    <include name="testInsuredInformationPage" />
                </methods>
            </class>
        </classes>
    </test>
<test name="Subset_TC02">
        <parameter name="InputExcelPath" value="Subset_TC02.xls" />
        <classes>
            <class name="com.idp.testcases.nbp.Mainflow">
                <methods>
                    <include name="testLogin" />
                    <include name="testLandingPage" />
                    <include name="testSearch" />
                    <include name="testInsuredInformationPage" />
                </methods>
            </class>
        </classes>
    </test>`

我试过的代码。

`public class RetryAnalyzerImpl implements IRetryAnalyzer{
    private int retryCount = 0;
     private int maxRetryCount = 1;
    @Override
    public boolean retry(ITestResult arg0) {
        if(retryCount < maxRetryCount) { 
            retryCount++; 
            return true; 
            } 
        return false; 
        } 
    }`

但这只会重新运行失败的 testmethod ,而不是整个测试用例。

 Example Test Result:

请帮我找一个重新运行整个测试用例的解决方案自动(例如:在这种情况下为Subset_TC01)

0 个答案:

没有答案