We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if __name__ == '__main__': # 报告存放路径,可设置相对路径 print(os.system('google-chrome --version')) print(os.system('chrome --version')) print(os.system('chromedriver -v')) rpfilepath = rpfolder filename = EmailConfData.attachment_html_filename file_path = rpfilepath + "/" + filename file_result = open(file_path, 'wb') # 定义测试报告 runner = HTMLTestRunner(stream=file_result, title=u"**测试报告", description=u"**自动化测试", tester=u"chandler", rerun=2) # 运行测试用例 suite = unittest.defaultTestLoader.discover(CommonDate.path+'/testcase', pattern='test*.py') print(suite) print(runner.run(suite)) file_result.close() # 发送邮件 send_emails() # 发送到飞书 send_result_to_feishu()
sh: 1: google-chrome: not found 32512 Google Chrome for Testing 118.0.5993.70 0 ChromeDriver 118.0.5993.70 (e52f33f30b91b4ddfad649acddc39ab570473b86-refs/branch-heads/5993@{#1216}) 0 headless_mode enable Running on Linux <unittest.suite.TestSuite tests=[<unittest.suite.TestSuite tests=[<unittest.suite.TestSuite tests=[]>, <unittest.suite.TestSuite tests=[<test_1_Login.TestLoginPage testMethod=test_1001_get_ver_code_with_error_phone>, <test_1_Login.TestLoginPage testMethod=test_1002_get_ver_code_with_error_email>, <test_1_Login.TestLoginPage testMethod=test_1003_login_with_error_ver_code_email>, <test_1_Login.TestLoginPage testMethod=test_1004_login_with_error_ver_code_phone>, <test_1_Login.TestLoginPage testMethod=test_1005_get_ver_code_with_empty_area_code>, <test_1_Login.TestLoginPage testMethod=test_1006_get_ver_code_with_empty_phone>, <test_1_Login.TestLoginPage testMethod=test_1007_get_ver_code_with_empty_email>, <test_1_Login.TestLoginPage testMethod=test_1008_get_ver_code_with_correct_phone>, <test_1_Login.TestLoginPage testMethod=test_1009_get_ver_code_with_correct_email>, <test_1_Login.TestLoginPage testMethod=test_1010_not_agree_policy_phone>, <test_1_Login.TestLoginPage testMethod=test_1011_not_agree_policy_email>, <test_1_Login.TestLoginPage testMethod=test_1012_login_with_phone_correct>]>]>, <unittest.suite.TestSuite tests=[<unittest.suite.TestSuite tests=[]>, <unittest.suite.TestSuite tests=[<test_2_Notes.TestNotesPage testMethod=test_2001_close_popup_windows>]>]>, <unittest.suite.TestSuite tests=[<unittest.suite.TestSuite tests=[<test_3_BooxDrop.TestBooxDropPage testMethod=test_3001_push_file>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3002_repush_file>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3003_search_file>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3004_delete_file>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3005_cancel_delete_file>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3006_push_oversize_file>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3101_push_screensaver>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3102_search_screensaver>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3103_repush_screensaver>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3104_delete_screensaver>, <test_3_BooxDrop.TestBooxDropPage testMethod=test_3105_cancel_delete_screensaver>]>, <unittest.suite.TestSuite tests=[]>]>, <unittest.suite.TestSuite tests=[<unittest.suite.TestSuite tests=[]>, <unittest.suite.TestSuite tests=[<test_4_PushRead.TestPushReadPage testMethod=test_4001_push_url_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4002_push_error_url_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4003_create_folder_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4004_rename_folder_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4005_delete_cancel_folder_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4006_delete_folder_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4007_rename_url_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4008_edit_favorite_url_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4009_delete_cancel_url_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4010_delete_url_webpage>, <test_4_PushRead.TestPushReadPage testMethod=test_4101_create_rss_group>, <test_4_PushRead.TestPushReadPage testMethod=test_4102_rename_rss_group>, <test_4_PushRead.TestPushReadPage testMethod=test_4103_delete_rss_group>, <test_4_PushRead.TestPushReadPage testMethod=test_4201_create_opds_group>, <test_4_PushRead.TestPushReadPage testMethod=test_4202_rename_rss_group>, <test_4_PushRead.TestPushReadPage testMethod=test_4203_delete_opds_group>]>]>]> XTestRunner Running tests... ---------------------------------------------------------------------- Generating HTML reports... <XTestRunner.htmlrunner.result._TestResult run=0 errors=0 failures=0> Done. Finished: SUCCESS
从Jenkins运行日志看到suite是有内容的,但是runner.run(suite)打印出来是<XTestRunner.htmlrunner.result._TestResult run=0 errors=0 failures=0>,没有执行用例 同样的代码在本地的linux中运行可以正确运行全部用例,有人知道是什么回事吗
The text was updated successfully, but these errors were encountered:
@defnngj
Sorry, something went wrong.
不是XTestRunner 的问题,指定的运行目录CommonDate.path+'/testcase'不对,linux 和本地有差异,导致 unittest 在linux 下面根据指定的目录找不到用例,所以执行用例数为 0 。
CommonDate.path+'/testcase'
No branches or pull requests
run.py
Jenkins输入日志:
从Jenkins运行日志看到suite是有内容的,但是runner.run(suite)打印出来是<XTestRunner.htmlrunner.result._TestResult run=0 errors=0 failures=0>,没有执行用例
同样的代码在本地的linux中运行可以正确运行全部用例,有人知道是什么回事吗
The text was updated successfully, but these errors were encountered: