feat: make locusts as httprunner plugin

This commit is contained in:
debugtalk
2019-10-25 16:40:47 +08:00
parent 890f2796c0
commit 22eb592eec
10 changed files with 158 additions and 54 deletions

View File

@@ -283,31 +283,3 @@ class HttpRunner(object):
""" get test reuslt summary.
"""
return self._summary
def prepare_locust_tests(path):
""" prepare locust testcases
Args:
path (str): testcase file path.
Returns:
list: locust tests data
[
testcase1_dict,
testcase2_dict
]
"""
tests_mapping = loader.load_tests(path)
testcases = parser.parse_tests(tests_mapping)
locust_tests = []
for testcase in testcases:
testcase_weight = testcase.get("config", {}).pop("weight", 1)
for _ in range(testcase_weight):
locust_tests.append(testcase)
return locust_tests