From ba1d533c18147b85cd24d34135b9c1413433d6c9 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 4 Jun 2020 17:38:18 +0800 Subject: [PATCH] feat: log export variables --- httprunner/runner.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/httprunner/runner.py b/httprunner/runner.py index d3e324b1..cbac56b9 100644 --- a/httprunner/runner.py +++ b/httprunner/runner.py @@ -46,6 +46,7 @@ class HttpRunner(object): __step_datas: List[StepData] = None __session: HttpSession = None __session_variables: VariablesMapping = {} + __export_variables: VariablesMapping = {} # time __start_at: float = 0 __duration: float = 0 @@ -249,6 +250,7 @@ class HttpRunner(object): self.__step_datas: List[StepData] = [] self.__session = self.__session or HttpSession() self.__session_variables = {} + self.__export_variables = {} # run teststeps for step in self.__teststeps: @@ -270,6 +272,11 @@ class HttpRunner(object): self.__session_variables.update(extract_mapping) self.__duration = time.time() - self.__start_at + + self.__export_variables = self.get_export_variables() + if self.__export_variables: + logger.info(f"export variables: {self.__export_variables}") + return self def run_path(self, path: Text) -> "HttpRunner": @@ -294,6 +301,9 @@ class HttpRunner(object): return self.__step_datas def get_export_variables(self) -> Dict: + if self.__export_variables: + return self.__export_variables + export_vars_mapping = {} for var_name in self.__config.export: if var_name not in self.__session_variables: