2

I would like to customise a assertion message that would write a message in the results jtl file. That message would be outputted in the dashboard report. It only seems that we can write custom messages to the jmeter log and not the results jtl file

4

2 回答 2

2

例如,除非您使用JSR223 断言和 groovy 语言,否则您无法自定义断言失败消息。

为此功能注册了一个增强请求:

请注意,我们今天贡献了这个特性的实现,它将在 JMeter 4.0 中可用。

您可以尝试每晚构建,该构建将于明天可用,或者使用“JMeter-trunk 的最后成功的 Jenkins 构建”链接下载:

这是它的样子:

响应断言中的自定义失败消息

于 2018-01-10T09:25:59.793 回答
1

即,将JSR223 Listener添加为您要自定义的断言消息的请求的子项,并将以下代码放入“脚本”区域:

sampleResult.getAssertionResults().each {assertionResult ->    
    assertionResult.setFailureMessage('My own clear and comprehensive message')
}

更多信息:

于 2018-01-10T09:44:38.723 回答