From 824cfaf515b8046d0a864901afe8fb0580db2c89 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Fri, 25 Jan 2019 13:44:19 +0800 Subject: [PATCH] each teststeps in one testcase share the same session. --- httprunner/client.py | 2 ++ httprunner/runner.py | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/httprunner/client.py b/httprunner/client.py index 3de5c47f..279c775c 100644 --- a/httprunner/client.py +++ b/httprunner/client.py @@ -169,6 +169,8 @@ class HttpSession(requests.Session): :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. """ + self.init_meta_data() + # record test name self.meta_data["name"] = name diff --git a/httprunner/runner.py b/httprunner/runner.py index 71147e57..e910cb0f 100644 --- a/httprunner/runner.py +++ b/httprunner/runner.py @@ -282,11 +282,9 @@ class Runner(object): """ self.meta_datas = [] config = testcase_dict.get("config", {}) - base_url = config.get("base_url") - # each testcase should have individual session. - http_client_session = self.http_client_session.__class__(base_url) - test_runner = Runner(config, self.functions, http_client_session) + # each teststeps in one testcase (YAML/JSON) share the same session. + test_runner = Runner(config, self.functions, self.http_client_session) tests = testcase_dict.get("teststeps", [])