seldom-platform icon indicating copy to clipboard operation
seldom-platform copied to clipboard

runner.py文件中 run()方法为什么不把执行结果返回呢?

Open yuanroc opened this issue 2 years ago • 1 comments

文件地址:running.runner.py 个人认为好处: 1、可以针对结果进行分析统计 2、针对返回结果进行二次策略性调用 3、主要添加返回结果:result=runner.run(suits)

改过的一系列方法:含关联文件 def run(self, suits) -> None: """ run test case """ if self.debug is False: for filename in os.listdir(os.getcwd()): if filename == "reports": break else: os.mkdir(os.path.join(os.getcwd(), "reports"))

        if (self.report is None) and (BrowserConfig.REPORT_PATH is not None):
            report_path = BrowserConfig.REPORT_PATH
        else:
            report_path = BrowserConfig.REPORT_PATH = os.path.join(os.getcwd(), "reports", self.report)

        with open(report_path, 'wb') as fp:
            if report_path.split(".")[-1] == "xml":
                runner = XMLTestRunner(output=fp, logger=log_cfg)
                result=runner.run(suits)
            else:
                runner = HTMLTestRunner(stream=fp, title=self.title, tester=self.tester,
                                        description=self.description,
                                        language=self.language, blacklist=self.blacklist, whitelist=self.whitelist,
                                        logger=log_cfg)
                result=runner.run(suits, rerun=self.rerun, save_last_run=self.save_last_run)

        log.success(f"generated html file: file:///{report_path}")
        log.success(f"generated log file: file:///{BrowserConfig.LOG_PATH}")
        if self.open is True:
            webbrowser.open_new(f"file:///{report_path}")
    else:
        runner = DebugTestRunner(
            blacklist=self.blacklist,
            whitelist=self.whitelist,
            verbosity=2)
        result=runner.run(suits)

    log.success(f"A1 run the test in debug mode without generating HTML report!\n{result}")
    return result

yuanroc avatar Feb 13 '23 10:02 yuanroc

seldom 支持生成 xml 格式的报告。你可以解析 xml 文件, seldom-platform 正式解析 xml 报告将结果写入数据库的。

你的描述 不知道是提问还是建议。代码也没有正确的使用 markdown ,有点乱。

defnngj avatar Feb 16 '23 14:02 defnngj