英文:
JMeter failure resport
问题
我想设置一些测试,但无法设置一个汇总报告,以便查看失败的测试。
案例1 - 正确的断言但模糊的报告
示例:我想检查状态为400的测试用例的API响应标头和正文是否正确。
设置:一个带有一个或多个响应断言的HTTP请求。
在汇总报告中看到的内容:尽管所有断言都得到满足,但调用已标记为错误(由于400状态)。
案例2 - 断言失效但报告干净
如果我在响应断言中标记为“忽略状态”,则不会将400响应标记为错误,但如果与错误代码有关的断言不匹配,则汇总报告不会记录失败。
我需要的是
一份报告,其中跟踪了多少测试基于(未满足的)断言而失败,而不是基于响应的HTTP状态。我该如何获得这个?
英文:
I want to set up some tests but cannot set up a summary report where I can see the failed tests.
Case 1 - correct assertions but an ambiguous report
Example: I want to check that the API response headers and body are correct for test-case with status=400.
Setup: an HTTP Request with one or more Response Assertions.
What I see in the Summary report: despite that all assertions were satisfied, the call has been tagged as an error (due to 400 status).
Case 2 - broken assertions but a clean report
If I flag "Ignore Status" in the Response Assertion, the 400 response is not tagged as an error but if the assertion about the error code is not matched, the Summary Report does not note the failure.
What I need
A report where is tracked how many tests failed based on (not satisfied) assertions and not on the HTTP status of the response. How can I get this?
答案1
得分: 1
在这种情况下:
- 如果响应代码与
400
不同,第一个断言将失败。 - 如果响应中找不到预期的文本
some text which has to be present
,第二个断言将失败。
如果响应代码是 400
并且找到了 some text which has to be present
,则采样器将标记为通过。
更多信息:JMeter响应断言是什么?
英文:
You will need to go for several Response Assertions
-
Check that status code is 400 and don't mark the request as failed
-
Check that the response contains the anticipated text:
In this case:
- First assertion will fail if the response code will differ from
400
- Second assertion will fail if
some text which has to be present
won't be found in the response
If the response code is 400
and some text which has to be present
is found the sampler will be marked as passed.
More information: What Are JMeter Response Assertions?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论