From 224cb999ef3393ceb1285cbc9f4d66fe266390d6 Mon Sep 17 00:00:00 2001 From: zhaoyafan Date: Wed, 31 Aug 2022 04:24:00 +0800 Subject: [PATCH] 22083102 --- .gitignore | 1 + Business/Class/HTMLTestRunner.py | 1 + Runner/API/1.html | 689 ------------------ .../{api_runner.json => DefaultRunner.json} | 0 Runner/API/DefaultRunner.py | 8 +- Runner/API/DefaultRunnerGUI.py | 5 +- README.md => Temp/README.md | 0 main.py => Temp/main.py | 0 main2.py => Temp/main2.py | 0 main3.py => Temp/main3.py | 0 main4.py => Temp/main4.py | 0 main5.py => Temp/main5.py | 0 main6.py => Temp/main6.py | 0 main7.py => Temp/main7.py | 0 main8.py => Temp/main8.py | 0 main9.py => Temp/main9.py | 0 run.py => Temp/run.py | 0 test.log => Temp/test.log | 0 test_case.py => Temp/test_case.py | 0 19 files changed, 7 insertions(+), 697 deletions(-) delete mode 100644 Runner/API/1.html rename Runner/API/{api_runner.json => DefaultRunner.json} (100%) rename README.md => Temp/README.md (100%) rename main.py => Temp/main.py (100%) rename main2.py => Temp/main2.py (100%) rename main3.py => Temp/main3.py (100%) rename main4.py => Temp/main4.py (100%) rename main5.py => Temp/main5.py (100%) rename main6.py => Temp/main6.py (100%) rename main7.py => Temp/main7.py (100%) rename main8.py => Temp/main8.py (100%) rename main9.py => Temp/main9.py (100%) rename run.py => Temp/run.py (100%) rename test.log => Temp/test.log (100%) rename test_case.py => Temp/test_case.py (100%) diff --git a/.gitignore b/.gitignore index dc34e62..c3c5252 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pyc *.pyo ~$*.* +venv __pycache__ diff --git a/Business/Class/HTMLTestRunner.py b/Business/Class/HTMLTestRunner.py index abcdebb..d4f9fde 100644 --- a/Business/Class/HTMLTestRunner.py +++ b/Business/Class/HTMLTestRunner.py @@ -992,6 +992,7 @@ class HTMLTestRunner(Template_mixin): self.passrate = None self.errormsg = None self.logspath = log and os.path.abspath(log) + self.logspath and open(self.logspath, 'wb').close() self.logo = logo self.sign = sign self.stream = stream or (report and open(os.path.abspath(report), 'wb')) diff --git a/Runner/API/1.html b/Runner/API/1.html deleted file mode 100644 index a44175b..0000000 --- a/Runner/API/1.html +++ /dev/null @@ -1,689 +0,0 @@ - - - - 测试报告 - - - - - - - - - - - - - - - -
-
-
- -
-
-
-
-

测试报告

- -

开始时间 : 2022-08-21 02:45:51

- -

合计耗时 : 00:00:03

- -

测试结果 : 总共 4,通过 4,失败 0,错误 0,通过率 100.00%

- -

失败用例 :

- -

错误用例 :

- -

-
-
-
-
- - -
-

- 概要 100.00% - 通过 4 - 失败 0 - 错误 0 - 全部 4 -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
测试用例说明总计通过失败错误耗时详细
测试用例44003.008秒查看全部
test0001_login2
P0:测试正常登录 - -
-
pt1_1:
-2022-08-21 02:45:51,565 - D: test0001_login2
-2022-08-21 02:45:51,902 - D: 
-[->]
-GET / HTTP/1.1
-Host: www.fanscloud.net
-User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
-Accept-Encoding: gzip, deflate
-Accept: */*
-Connection: keep-alive
-
-
-[<-]
-HTTP/1.1 200 OK
-Server: nginx
-Date: Sat, 20 Aug 2022 18:45:51 GMT
-Content-Type: text/html; charset=UTF-8
-Transfer-Encoding: chunked
-Connection: keep-alive
-Vary: Accept-Encoding
-Content-Encoding: gzip
-
-<!doctype html>
-<html lang="zh-cn">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <title>阿凡的Blog🌿</title>
-    <meta name="keywo  ... [MORE 98% OMITTED HERE]
-
-
-
test0002_login4
P0:测试正常登录 - -
-
pt1_2:
-2022-08-21 02:45:52,410 - D: test0002_login4
-2022-08-21 02:45:52,709 - D: 
-[->]
-GET / HTTP/1.1
-Host: www.fanscloud.net
-User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
-Accept-Encoding: gzip, deflate
-Accept: */*
-Connection: keep-alive
-
-
-[<-]
-HTTP/1.1 200 OK
-Server: nginx
-Date: Sat, 20 Aug 2022 18:45:52 GMT
-Content-Type: text/html; charset=UTF-8
-Transfer-Encoding: chunked
-Connection: keep-alive
-Vary: Accept-Encoding
-Content-Encoding: gzip
-
-<!doctype html>
-<html lang="zh-cn">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <title>阿凡的Blog🌿</title>
-    <meta name="keywo  ... [MORE 98% OMITTED HERE]
-
-
-
test0003_login1
P1:测试正常登录 - -
-
pt1_3:
-2022-08-21 02:45:53,136 - D: test0003_login1
-2022-08-21 02:45:53,426 - D: 
-[->]
-GET / HTTP/1.1
-Host: www.fanscloud.net
-User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
-Accept-Encoding: gzip, deflate
-Accept: */*
-Connection: keep-alive
-
-
-[<-]
-HTTP/1.1 200 OK
-Server: nginx
-Date: Sat, 20 Aug 2022 18:45:53 GMT
-Content-Type: text/html; charset=UTF-8
-Transfer-Encoding: chunked
-Connection: keep-alive
-Vary: Accept-Encoding
-Content-Encoding: gzip
-
-<!doctype html>
-<html lang="zh-cn">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <title>阿凡的Blog🌿</title>
-    <meta name="keywo  ... [MORE 98% OMITTED HERE]
-
-
-
test0004_login3
P1:测试正常登录 - -
-
pt1_4:
-2022-08-21 02:45:53,883 - D: test0004_login3
-2022-08-21 02:45:54,188 - D: 
-[->]
-GET / HTTP/1.1
-Host: www.fanscloud.net
-User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
-Accept-Encoding: gzip, deflate
-Accept: */*
-Connection: keep-alive
-
-
-[<-]
-HTTP/1.1 200 OK
-Server: nginx
-Date: Sat, 20 Aug 2022 18:45:54 GMT
-Content-Type: text/html; charset=UTF-8
-Transfer-Encoding: chunked
-Connection: keep-alive
-Vary: Accept-Encoding
-Content-Encoding: gzip
-
-<!doctype html>
-<html lang="zh-cn">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <title>阿凡的Blog🌿</title>
-    <meta name="keywo  ... [MORE 98% OMITTED HERE]
-
-
-
总计44003.008秒通过:100.00%
- - - - - -
- - -
- - diff --git a/Runner/API/api_runner.json b/Runner/API/DefaultRunner.json similarity index 100% rename from Runner/API/api_runner.json rename to Runner/API/DefaultRunner.json diff --git a/Runner/API/DefaultRunner.py b/Runner/API/DefaultRunner.py index 1379403..71216c3 100644 --- a/Runner/API/DefaultRunner.py +++ b/Runner/API/DefaultRunner.py @@ -231,8 +231,8 @@ class TestCase: {'sign': ' <= ', 'method': self.assert_unit.assertLessEqual, 'reverse': 0, 'cast': float}, {'sign': ' =~ ', 'method': self.assert_unit.assertIn, 'reverse': 1, 'cast': str}, {'sign': ' !~ ', 'method': self.assert_unit.assertNotIn, 'reverse': 1, 'cast': str}, - {'sign': ' > ', 'method': self.assert_unit.assertGreater, 'reverse': 0, 'cast': float}, - {'sign': ' < ', 'method': self.assert_unit.assertLess, 'reverse': 0, 'cast': float}, + {'sign': ' > ', 'method': self.assert_unit.assertGreater, 'reverse': 0, 'cast': float}, + {'sign': ' < ', 'method': self.assert_unit.assertLess, 'reverse': 0, 'cast': float}, {'sign': ' not in ', 'method': self.assert_unit.assertNotIn, 'reverse': 0, 'cast': 0}, {'sign': ' in ', 'method': self.assert_unit.assertIn, 'reverse': 0, 'cast': 0}, {'sign': ' *= ', 'method': self.assert_cust.assertPreWith, 'reverse': 0, 'cast': str}, @@ -604,9 +604,7 @@ class TestCase: raise Exception('Pre-exec case cannot use data files set.') self.pre_executed_list.append(case_id) self._test_unit(func_name=func_name, data=data) - # self.__getattribute__(func_name)(data=data) self._test_unit(func_name=func_name, data=main_case, main=True) - # self.__getattribute__(func_name)(data=main_case, main=True) self._l and self._l.clear() write_test_result(main_case_object_cell, 'Passed') except AssertionError: @@ -785,6 +783,6 @@ if __name__ == '__main__': testSuite = unittest.TestSuite() for obj in config['suite']: testSuite.addTest(unittest.makeSuite( - testCaseClass=TestCase(workbook=obj['workbook'], testcase=obj['testcase'], module=obj['module'], caseid=obj['caseid'], testlves=obj['levels'], organize_mode=obj['organize'], write_test_result=obj['result']).main(), prefix='test' + testCaseClass=TestCase(workbook=obj['workbook'] or './.xlsx', testcase=obj['testcase'] or '测试用例', module=obj['module'], caseid=obj['caseid'], testlves=obj['levels'], organize_mode=obj['organize'], write_test_result=obj['result']).main(), prefix='test' )) HTMLTestRunner(verbosity=config['verbosity'], report=abs_path(config['report'] or None), log=abs_path(config['log'] or None), title=config['title'] or None, description=config['description'] or None).run(testSuite) diff --git a/Runner/API/DefaultRunnerGUI.py b/Runner/API/DefaultRunnerGUI.py index 338e3a1..8f7532b 100644 --- a/Runner/API/DefaultRunnerGUI.py +++ b/Runner/API/DefaultRunnerGUI.py @@ -1,5 +1,4 @@ import os -import sys import time import threading from Base.Class.GUI import * @@ -121,7 +120,7 @@ if __name__ == '__main__': window.mainloop() _root = _Window('接口自动化测试', w=572, h=450, bg=_cl[0]) - _ct.append(_root.Labels(row=0, col=0, font=_ft, bg=_cl[0], fg=_cl[1], text='测试用例')) + _ct.append(_root.Labels(row=0, col=0, font=_ft, bg=_cl[0], fg=_cl[1], text='用例文件')) _ct.append(_root.Entrys(row=0, col=1, font=_ft, bg=_cl[1], fg=_cl[2], w=54, readonly=True, text='')) _ct.append(_root.Button(row=0, col=2, font=_ft, bg=_cl[0], fg=_cl[1], text='选择文件', function=_root.open_testcase)) _ct.append(_root.Labels(row=1, col=0, font=_ft, bg=_cl[0], fg=_cl[1], text='用例名称')) @@ -141,7 +140,7 @@ if __name__ == '__main__': _ct.append(_root.Labels(row=8, col=0, font=_ft, bg=_cl[0], fg=_cl[1], text='报告输出路径')) _ct.append(_root.Entrys(row=8, col=1, font=_ft, bg=_cl[1], fg=_cl[2], w=54, readonly=True, text='')) _ct.append(_root.Button(row=8, col=2, font=_ft, bg=_cl[0], fg=_cl[1], text='选择目录', function=_root.save_report)) - _ct.append(_root.Labels(row=9, col=0, font=_ft, bg=_cl[0], fg=_cl[1], text='报告输出路径')) + _ct.append(_root.Labels(row=9, col=0, font=_ft, bg=_cl[0], fg=_cl[1], text='日志输出路径')) _ct.append(_root.Entrys(row=9, col=1, font=_ft, bg=_cl[1], fg=_cl[2], w=54, readonly=True, text='')) _ct.append(_root.Button(row=9, col=2, font=_ft, bg=_cl[0], fg=_cl[1], text='选择目录', function=_root.save_log)) _ct.append(_root.Labels(row=10, col=0, font=_ft, bg=_cl[0], fg=_cl[1], text='报告标题')) diff --git a/README.md b/Temp/README.md similarity index 100% rename from README.md rename to Temp/README.md diff --git a/main.py b/Temp/main.py similarity index 100% rename from main.py rename to Temp/main.py diff --git a/main2.py b/Temp/main2.py similarity index 100% rename from main2.py rename to Temp/main2.py diff --git a/main3.py b/Temp/main3.py similarity index 100% rename from main3.py rename to Temp/main3.py diff --git a/main4.py b/Temp/main4.py similarity index 100% rename from main4.py rename to Temp/main4.py diff --git a/main5.py b/Temp/main5.py similarity index 100% rename from main5.py rename to Temp/main5.py diff --git a/main6.py b/Temp/main6.py similarity index 100% rename from main6.py rename to Temp/main6.py diff --git a/main7.py b/Temp/main7.py similarity index 100% rename from main7.py rename to Temp/main7.py diff --git a/main8.py b/Temp/main8.py similarity index 100% rename from main8.py rename to Temp/main8.py diff --git a/main9.py b/Temp/main9.py similarity index 100% rename from main9.py rename to Temp/main9.py diff --git a/run.py b/Temp/run.py similarity index 100% rename from run.py rename to Temp/run.py diff --git a/test.log b/Temp/test.log similarity index 100% rename from test.log rename to Temp/test.log diff --git a/test_case.py b/Temp/test_case.py similarity index 100% rename from test_case.py rename to Temp/test_case.py