locusts support weight feature

This commit is contained in:
debugtalk
2018-10-29 20:49:24 +08:00
parent aed7013b1d
commit 2d5ff04b46
10 changed files with 133 additions and 50 deletions

View File

@@ -40,13 +40,10 @@ def gen_locustfile(testcase_file_path):
"templates",
"locustfile_template"
)
testcases = loader.load_tests(testcase_file_path)
host = testcases[0].get("config", {}).get("request", {}).get("base_url", "")
with io.open(template_path, encoding='utf-8') as template:
with io.open(locustfile_path, 'w', encoding='utf-8') as locustfile:
template_content = template.read()
template_content = template_content.replace("$HOST", host)
template_content = template_content.replace("$TESTCASE_FILE", testcase_file_path)
locustfile.write(template_content)