2016-11-19 124 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()) 

測試套件將再次再次如果任一試驗箱子具有故障或錯誤執行。