We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate中需要验证自定义函数的结果,此函数只会返回true/false 当函数返回和预期一致时,report 内容正常,validate 信息都有 当函数返回和预期不一致,即 validate fail 的情况,report 中信息缺失,而且step 计算有误
"httprunner_version": "3.1.11", "python_version": "CPython 3.9.17", "platform": "Linux-3.10.0-1160.95.1.el7.x86_64-x86_64-with-glibc2.17"
config: base_url: https://yapi.uihcloud.cn/mock/375 name: case-list teststeps: - name: hook test variables: page: 1 num1: 5 num2: 12 request: method: GET params: page: $page project: 11 url: /testcase/ validate: - eq: ["${compare_nums($num1, $num2)}", false] - gt: ["body.results[0].id", 10]
def compare_nums(a, b): return a > b
hrun cases/validate.yml --disable-warnings --save-tests
"records": [ { "success": true, "name": "hook test", "data": { "success": true, "validators": { "validate_extractor": [ { "comparator": "equal", "check": false, "check_value": false, "expect": false, "expect_value": false, "message": "", "check_result": "pass" }, { "comparator": "greater_than", "check": "body.results[0].id", "check_value": 2923, "expect": 10, "expect_value": 10, "message": "", "check_result": "pass" } ] } }, "export_vars": {} } ]
无用字段已经剔除,重点只关注records
{ "success": false, "stat": { "testcases": { "total": 1, "success": 0, "fail": 1 }, "teststeps": { "total": 0, "failures": 1, "successes": -1 } }, "details": [ { "name": "case-list", "success": false, "records": [] } ] }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
validate如果包含自定义函数,当他验证失败后,生成的report 中record 为空
版本信息
用例
函数
CMD
report
validate success
validate fail
The text was updated successfully, but these errors were encountered: