2016-11-19 122 views

回答

0

能够解决这个问题。

下面是相同的示例代码:

import HTMLTestRunner 
import os 
import unittest 

def testsuite(): 
    suite = unittest.TestSuite() 
    suite.addTest("Add your test here") 


    return suite 

reportloc = os.getcwd() 
outfile = open(reportloc + "TestReport.html", "w") 
executor = HTMLTestRunner.HTMLTestRunner(stream=outfile, title="Test Report", description="Tests") 

envresult = executor.run(testsuite()) 
if envresult.error_count >= 1 or envresult.failure_count >= 1: 
    executor.run(testsuite()) 

测试套件将再次再次如果任一试验箱子具有故障或错误执行。