【问题标题】:Jmeter Assertion failure reasonJmeter断言失败原因
【发布时间】:2016-04-26 11:29:32
【问题描述】:

我正在 Jmeter 上进行测试。这是采样器结果的一部分-

Load time: 520
Connect Time: 0
Latency: 520
Size in bytes: 504
Headers size in bytes: 458
Body size in bytes: 46
Sample Count: 1
Error Count: 1
Response code: 201
Response message: Created

所以我添加了配置如下的“响应断言”-

适用于:仅主要样本,要测试的响应字段:响应代码,模式匹配规则:等于,要测试的模式:201。

运行时请求失败,原因是这样的:

Assertion error: false
Assertion failure: true
Assertion failure message: Test failed: code expected to equal /

****** received  : 201[[[  ]]]

****** comparison: 201[[[

]]]

/

究竟是什么问题?

【问题讨论】:

    标签: api jmeter http-post


    【解决方案1】:

    我假设你在描述中指定了

    要测试的响应字段:响应消息

    错误,因为失败指向您比较响应代码的事实。

    鉴于此,看起来您在“201”之后意外有换行符,这是不可见的,但会导致比较失败。所以只需删除“201”之后的所有空格/换行符。确保要测试的 Patterns 正好是 201,没有别的。

    【讨论】:

    • 你是对的。我实际上以为我已经尝试过了。仅完全删除参数并重新输入即可。谢谢。
    【解决方案2】:

    问题是

    Assertion error: false
    Assertion failure: true
    Assertion failure message: Test failed: code expected to equal /
    ****** received  : 201[[[  ]]]
    
    ****** comparison: 201[[[
    
    ]]]
    /
    

    问题的解决方案:-

    如果您在Server Name or IP 中添加这样的lifecharger.org/archives/ 链接,则需要将其更改为lifecharger.org

    Path /archives/ 中添加您的链接路径,然后就可以了。

    谢谢

    【讨论】:

      猜你喜欢
      • 2018-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多