forked from httprunner/httprunner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request httprunner#975 from httprunner/dev
## 3.1.4 (2020-07-30) **Changed** - change: override variables strategy, step variables > extracted variables from previous steps **Fixed** - fix: parameters feature with custom functions - fix: request json field with variable reference - fix: pickle BufferedReader TypeError in upload feature
- Loading branch information
Showing
26 changed files
with
124 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# NOTE: Generated By HttpRunner v3.1.3 | ||
# NOTE: Generated By HttpRunner v3.1.4 | ||
# FROM: basic.yml | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# NOTE: Generated By HttpRunner v3.1.3 | ||
# NOTE: Generated By HttpRunner v3.1.4 | ||
# FROM: hooks.yml | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# NOTE: Generated By HttpRunner v3.1.3 | ||
# NOTE: Generated By HttpRunner v3.1.4 | ||
# FROM: load_image.yml | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# NOTE: Generated By HttpRunner v3.1.3 | ||
# NOTE: Generated By HttpRunner v3.1.4 | ||
# FROM: upload.yml | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# NOTE: Generated By HttpRunner v3.1.3 | ||
# NOTE: Generated By HttpRunner v3.1.4 | ||
# FROM: validate.yml | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/postman_echo/logs/request_methods/hardcode.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}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/postman_echo/request_methods/demo_testsuite_yml/request_with_testcase_reference_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/postman_echo/request_methods/request_with_parameters_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/postman_echo/request_methods/request_with_testcase_reference_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/postman_echo/request_methods/validate_with_functions_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/postman_echo/request_methods/validate_with_variables_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters