mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
change: rename StepData to StepResult
This commit is contained in:
@@ -12,13 +12,13 @@ from httprunner.utils import get_platform, ExtendJSONEncoder
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def session_fixture(request):
|
||||
"""setup and teardown each task"""
|
||||
logger.info(f"start running testcases ...")
|
||||
logger.info("start running testcases ...")
|
||||
|
||||
start_at = time.time()
|
||||
|
||||
yield
|
||||
|
||||
logger.info(f"task finished, generate task summary for --save-tests")
|
||||
logger.info("task finished, generate task summary for --save-tests")
|
||||
|
||||
summary = {
|
||||
"success": True,
|
||||
@@ -36,24 +36,27 @@ def session_fixture(request):
|
||||
summary["success"] &= testcase_summary.success
|
||||
|
||||
summary["stat"]["testcases"]["total"] += 1
|
||||
summary["stat"]["teststeps"]["total"] += len(testcase_summary.step_datas)
|
||||
summary["stat"]["teststeps"]["total"] += len(testcase_summary.step_results)
|
||||
if testcase_summary.success:
|
||||
summary["stat"]["testcases"]["success"] += 1
|
||||
summary["stat"]["teststeps"]["successes"] += len(
|
||||
testcase_summary.step_datas
|
||||
testcase_summary.step_results
|
||||
)
|
||||
else:
|
||||
summary["stat"]["testcases"]["fail"] += 1
|
||||
summary["stat"]["teststeps"]["successes"] += (
|
||||
len(testcase_summary.step_datas) - 1
|
||||
len(testcase_summary.step_results) - 1
|
||||
)
|
||||
summary["stat"]["teststeps"]["failures"] += 1
|
||||
|
||||
testcase_summary_json = testcase_summary.dict()
|
||||
testcase_summary_json["records"] = testcase_summary_json.pop("step_datas")
|
||||
testcase_summary_json["records"] = testcase_summary_json.pop("step_results")
|
||||
summary["details"].append(testcase_summary_json)
|
||||
|
||||
summary_path = r"/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/postman_echo/logs/request_methods/hardcode.summary.json"
|
||||
summary_path = os.path.join(
|
||||
os.getcwd(),
|
||||
"examples/postman_echo/logs/request_methods/hardcode.summary.json"
|
||||
)
|
||||
summary_dir = os.path.dirname(summary_path)
|
||||
os.makedirs(summary_dir, exist_ok=True)
|
||||
|
||||
@@ -61,4 +64,3 @@ def session_fixture(request):
|
||||
json.dump(summary, f, indent=4, ensure_ascii=False, cls=ExtendJSONEncoder)
|
||||
|
||||
logger.info(f"generated task summary: {summary_path}")
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ def session_fixture(request):
|
||||
|
||||
yield
|
||||
|
||||
logger.debug(f"teardown task fixture")
|
||||
logger.debug("teardown task fixture")
|
||||
|
||||
# teardown task
|
||||
# TODO: upload task summary
|
||||
|
||||
Reference in New Issue
Block a user