JMeter失败报告

huangapple go评论56阅读模式
英文:

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

  1. 需要执行多个响应断言

    1. 检查状态码是否为400,但不标记请求为失败

      JMeter失败报告

    2. 检查响应是否包含预期文本:

      JMeter失败报告

在这种情况下:

  1. 如果响应代码与 400 不同,第一个断言将失败。
  2. 如果响应中找不到预期的文本 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

  1. Check that status code is 400 and don't mark the request as failed

    JMeter失败报告

  2. Check that the response contains the anticipated text:

    JMeter失败报告

In this case:

  1. First assertion will fail if the response code will differ from 400
  2. 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?

huangapple
  • 本文由 发表于 2023年6月26日 16:57:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76555117.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定