首页 > 解决方案 > 自定义消息在 GUI 版本中有效,但在 CLI 中无效

问题描述

在 Ubuntu 18.04 上使用 Jmeter 5.2.1 版,我们运行了许多测试,其中一些具有自定义消息。下面是代码。

<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="C01 - ${marsha} Current Date" enabled="true">
    <collectionProp name="Asserion.test_strings">
        <stringProp name="1193219718">unsuccessfulSell=true</stringProp>
    </collectionProp>
    <stringProp name="Assertion.custom_message">C01 - ${marsha} Current Date - Product Not Available</stringProp>
    <stringProp name="Assertion.test_field">Assertion.sample_label</stringProp>
    <boolProp name="Assertion.assume_success">false</boolProp>
    <intProp name="Assertion.test_type">6</intProp>
</ResponseAssertion>

当我们在 GUI 版本中运行它时,我们会得到如下内容:

C01 - abzcy Current Date - Product Not Available

当我们使用 CLI 运行相同的测试时,我们根本没有收到任何消息。最初我认为它正在工作,但我看到了错误的列。

有什么想法吗?

附件是我所指的规则的屏幕截图。

断言屏幕的屏幕截图。

自定义消息根本不出来。

对于其他断言,我们没有这个问题。

标签: jmeterjmeter-5.0

解决方案


鉴于此响应断言配置,我无法重现您的问题:

在此处输入图像描述

当我在命令行非 GUI 模式下运行 JMeter 时,如下所示:

./jmeter -n -t test.jmx -l result.jtl

我可以在result.jtl文件 中看到自定义断言失败消息

在此处输入图像描述

您是否有机会自定义结果文件配置?特别是jmeter.save.saveservice.assertion_results_failure_message属性需要设置为true


推荐阅读