refactor: use HttpRunner as testcase base class

This commit is contained in:
debugtalk
2020-05-15 20:05:17 +08:00
parent 212130b91f
commit 2ab0b85985
12 changed files with 71 additions and 363 deletions

View File

@@ -10,10 +10,10 @@ from httprunner.exceptions import TestCaseFormatError
from httprunner.loader import load_testcase_file, load_folder_files
__TMPL__ = """# NOTICE: Generated By HttpRunner. DO'NOT EDIT!
from httprunner import HttpRunner, TConfig, TStep, TestCase
from httprunner import HttpRunner, TConfig, TStep
class {{ class_name }}(TestCase):
class {{ class_name }}(HttpRunner):
config = TConfig(**{{ config }})
teststeps = [
@@ -22,8 +22,8 @@ class {{ class_name }}(TestCase):
{% endfor %}
]
def test_start(self):
HttpRunner(self.config, self.teststeps).run()
if __name__ == "__main__":
{{ class_name }}().test_start()
"""