我想在Postman中参数化我的测试。这是POST请求的示例正文:
{
"entity_id": "{{entity_id}}",
"text": data.comment_name
}
Run Code Online (Sandbox Code Playgroud)
entity_id是全局变量,它可以正常工作,但是我想text从JSON文件中设置的值。
data.comment_name不起作用,它完全将我保存data.comment_name为文本变量。我想将此JSON文件的所有变量包含在收集运行器中。我怎样才能做到这一点?
我有像这样的xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="social_service_demo" time="0.583">
<testsuite name="demo / generate_access_token" id="60ec54b9-d67b-4f51-a20d-9794c3a85269" tests="2" time="0.583">
<error>
</error>
<testcase name="Token should be generated correctly, response is 200" time="0.583">
<failure type="AssertionFailure">
<![CDATA[Failed 1 times.]]>
</failure>
</testcase>
<testcase name="Returned JSON should contain access_token field" time="0.583">
<failure type="AssertionFailure">
<![CDATA[Failed 1 times.]]>
</failure>
</testcase>
</testsuite>
<testsuite name="demo / get_most_commented_entities" id="12aa656d-a702-4fc6-878c-2e0fde08021e" tests="1" time="0">
<error>
</error>
<testcase name="Response is 200" time="0">
<failure type="AssertionFailure">
<![CDATA[Failed 1 times.]]>
</failure>
</testcase>
</testsuite>
</testsuites>
Run Code Online (Sandbox Code Playgroud)
我需要计算出tests符合这条线的数字:
<testsuite name="demo / generate_access_token" id="60ec5" …