add testcase loader interface

This commit is contained in:
debugtalk
2018-08-05 10:37:42 +08:00
parent 7d612bf10e
commit bf0fb675bb
5 changed files with 32 additions and 25 deletions

View File

@@ -40,9 +40,8 @@ def gen_locustfile(testcase_file_path):
"templates",
"locustfile_template"
)
loader.load_test_dependencies()
testset = loader.load_test_file(testcase_file_path)
host = testset.get("config", {}).get("request", {}).get("base_url", "")
testcases = loader.load(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: