mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
docs: update changelog
This commit is contained in:
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
## 3.0.11 (2020-06-08)
|
## 3.0.11 (2020-06-08)
|
||||||
|
|
||||||
|
**Changed**
|
||||||
|
|
||||||
|
- change: override variables
|
||||||
|
(1) testcase: session variables > step variables > config variables
|
||||||
|
(2) testsuite: testcase variables > config variables
|
||||||
|
(3) testsuite testcase variables > testcase config variables
|
||||||
|
|
||||||
**Fixed**
|
**Fixed**
|
||||||
|
|
||||||
- fix: incorrect summary success when testcase failed
|
- fix: incorrect summary success when testcase failed
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# NOTE: Generated By HttpRunner v3.0.10
|
# NOTE: Generated By HttpRunner v3.0.11
|
||||||
# FROM: examples/httpbin/basic.yml
|
# FROM: examples/httpbin/basic.yml
|
||||||
|
|
||||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# NOTICE: Generated By HttpRunner.
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from loguru import logger
|
||||||
|
|
||||||
|
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 ...")
|
||||||
|
|
||||||
|
start_at = time.time()
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
logger.info(f"task finished, generate task summary for --save-tests")
|
||||||
|
|
||||||
|
summary = {
|
||||||
|
"success": True,
|
||||||
|
"stat": {
|
||||||
|
"testcases": {"total": 0, "success": 0, "fail": 0},
|
||||||
|
"teststeps": {"total": 0, "failures": 0, "successes": 0},
|
||||||
|
},
|
||||||
|
"time": {"start_at": start_at, "duration": time.time() - start_at},
|
||||||
|
"platform": get_platform(),
|
||||||
|
"details": [],
|
||||||
|
}
|
||||||
|
|
||||||
|
for item in request.node.items:
|
||||||
|
testcase_summary = item.instance.get_summary()
|
||||||
|
summary["success"] &= testcase_summary.success
|
||||||
|
|
||||||
|
summary["stat"]["testcases"]["total"] += 1
|
||||||
|
summary["stat"]["teststeps"]["total"] += len(testcase_summary.step_datas)
|
||||||
|
if testcase_summary.success:
|
||||||
|
summary["stat"]["testcases"]["success"] += 1
|
||||||
|
summary["stat"]["teststeps"]["successes"] += len(
|
||||||
|
testcase_summary.step_datas
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
summary["stat"]["testcases"]["fail"] += 1
|
||||||
|
summary["stat"]["teststeps"]["successes"] += (
|
||||||
|
len(testcase_summary.step_datas) - 1
|
||||||
|
)
|
||||||
|
summary["stat"]["teststeps"]["failures"] += 1
|
||||||
|
|
||||||
|
testcase_summary_json = testcase_summary.dict()
|
||||||
|
testcase_summary_json["records"] = testcase_summary_json.pop("step_datas")
|
||||||
|
summary["details"].append(testcase_summary_json)
|
||||||
|
|
||||||
|
summary_path = "/Users/debugtalk/MyProjects/HttpRunner-dev/HttpRunner/examples/httpbin/logs/upload.summary.json"
|
||||||
|
summary_dir = os.path.dirname(summary_path)
|
||||||
|
os.makedirs(summary_dir, exist_ok=True)
|
||||||
|
|
||||||
|
with open(summary_path, "w", encoding="utf-8") as f:
|
||||||
|
json.dump(summary, f, indent=4, ensure_ascii=False, cls=ExtendJSONEncoder)
|
||||||
|
|
||||||
|
logger.info(f"generated task summary: {summary_path}")
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# NOTE: Generated By HttpRunner v3.0.10
|
# NOTE: Generated By HttpRunner v3.0.11
|
||||||
# FROM: examples/httpbin/hooks.yml
|
# FROM: examples/httpbin/hooks.yml
|
||||||
|
|
||||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# NOTE: Generated By HttpRunner v3.0.10
|
# NOTE: Generated By HttpRunner v3.0.11
|
||||||
# FROM: examples/httpbin/load_image.yml
|
# FROM: examples/httpbin/load_image.yml
|
||||||
|
|
||||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# NOTE: Generated By HttpRunner v3.0.10
|
# NOTE: Generated By HttpRunner v3.0.11
|
||||||
# FROM: examples/httpbin/upload.yml
|
# FROM: examples/httpbin/upload.yml
|
||||||
|
|
||||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# NOTE: Generated By HttpRunner v3.0.10
|
# NOTE: Generated By HttpRunner v3.0.11
|
||||||
# FROM: examples/httpbin/validate.yml
|
# FROM: examples/httpbin/validate.yml
|
||||||
|
|
||||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||||
|
|||||||
+5
-5
@@ -453,18 +453,18 @@ def __make(tests_path: Text) -> NoReturn:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if not isinstance(test_content, Dict):
|
if not isinstance(test_content, Dict):
|
||||||
raise exceptions.FileFormatError(
|
logger.warning(f"test content not in dict format. \npath: {test_file}")
|
||||||
f"test content not in dict format: {test_content}"
|
continue
|
||||||
)
|
|
||||||
|
|
||||||
# api in v2 format, convert to v3 testcase
|
# api in v2 format, convert to v3 testcase
|
||||||
if "request" in test_content and "name" in test_content:
|
if "request" in test_content and "name" in test_content:
|
||||||
test_content = ensure_testcase_v3_api(test_content)
|
test_content = ensure_testcase_v3_api(test_content)
|
||||||
|
|
||||||
if "config" not in test_content:
|
if "config" not in test_content:
|
||||||
raise exceptions.FileFormatError(
|
logger.warning(
|
||||||
f"miss config part in testcase/testsuite: {test_content}"
|
f"Invalid testcase/testsuite: missing config part in testcase/testsuite.\npath: {test_file}"
|
||||||
)
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
test_content.setdefault("config", {})["path"] = test_file
|
test_content.setdefault("config", {})["path"] = test_file
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user