From ce83c7b05f6b2c5f16e7362e76e506f9713a8dc8 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 18 Apr 2019 16:28:11 +0800 Subject: [PATCH] fix: display api name when running api as testcase --- httprunner/parser.py | 3 +++ tests/httpbin/api/get_headers.yml | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/httprunner/parser.py b/httprunner/parser.py index 9dabd4e2..08c0bdbd 100644 --- a/httprunner/parser.py +++ b/httprunner/parser.py @@ -1254,6 +1254,9 @@ def parse_tests(tests_mapping): # encapsulate api as a testcase for api_content in tests_mapping["apis"]: testcase = { + "config": { + "name": api_content.get("name") + }, "teststeps": [api_content] } parsed_testcase = _parse_testcase(testcase, project_mapping) diff --git a/tests/httpbin/api/get_headers.yml b/tests/httpbin/api/get_headers.yml index 9871035f..a05e5bd5 100644 --- a/tests/httpbin/api/get_headers.yml +++ b/tests/httpbin/api/get_headers.yml @@ -1,9 +1,11 @@ -name: headers +name: get headers base_url: http://httpbin.org +variables: + expected_status_code: 200 request: url: /headers method: GET validate: - - eq: ["status_code", 200] + - eq: ["status_code", $expected_status_code] - eq: [content.headers.Host, "httpbin.org"]