我有一个带有一些测试的Selenium Python测试用例,我使用HTMLTestRunner为测试结果生成html报告。 我是uisng Python 2.7
报告未生成 HTMLTestRunner不能与最新的Selenium一起使用吗?
我的Selenium Python代码实现是:
import unittest
from Base.BaseTestCase import BaseTestCase
from HTMLTestRunner2 import HTMLTestRunner
class RegressionProject_TestCase2(BaseTestCase):
def test_000001_add_a_test_Project(self):
try:
print "*** test_add_a_test_project ***"
# self.login_page.userLogin_valid(Globals.login_username, Globals.login_password)
menu_bar = MenuBarPage(self.driver)
administration_page = menu_bar.click_add_project_blank()
administration_page.add_project("test", Globals.project_description_regression)
administration_page.click_save()
administration_page.click_ok_from_dialog()
self.assertTrue(administration_page.is_add_project_details_saved("test"),
"Add test project not saved. See error log for details")
except Exception:
base_page = BasePage(self.driver)
base_page.save_screenshot("Test add_test_project")
raise
# More tests
if __name__ == '__main__':
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(RegressionProject_TestCase2))
dateTimeStamp = time.strftime('%Y%m%d_%H_%M_%S')
test_result_dir = r"E:\test_runners\selenium_regression_test_5_1_1\ClearCore - Regression Test\TestReport"
outfile = file(os.path.join(test_result_dir, "TestReport_" + get_datetime_now() + ".html"), "wb")
runner = HTMLTestRunner.HTMLTestRunner(
stream=outfile,
title='Test the Report',
description='Result of tests'
)
runner.run(suite)
任何人都可以提供帮助,为什么测试报告没有生成?
我已按照以下网址中的示例报告:http://seleniumwithpython.blogspot.co.uk/2011/08/html-report-using-htmltestrunner.html
谢谢Riaz