从 jmeter 中的中央调用自定义断言消息
Call a custom assertion message from a central in jmeter
我是 jmeter 的新手,想知道是否可以从中央位置调用自定义断言消息。
Thread group 1
http sample
xpath extraction
custom assertion message
Thread group 2
http sample 1
xpath extraction
custom assertion message
http sample 2
xpath extraction
custom assertion message
自定义消息使用xpath提取获取响应代码,如果返回成功消息代码则忽略自定义消息。
如果响应代码不是成功响应,我们提取实际响应代码并在自定义断言消息中使用。
我想改为从一个中央位置调用自定义消息。
自定义断言如下:
if (!"SuccessResponseCode".equals(vars.get("xpathResponseCode")) && prev_result != null){
AssertionResult.setFailure(true);
AssertionResult.setFailureMessage("The response code is "+vars.get("xpathextractionResponseCode").toString()+" and the expected is expectedResponseCode"+ctx.getThreadGroup().getName()+" test case.");
}
所以我想调用外部自定义消息
自定义断言
线程组 2
http 示例 1
xpath提取
JS232 - 调用自定义消息
http 示例 2
xpath提取
JS232 - 调用自定义消息
只需将您的断言放在与 Thread Groups 相同的级别即可。
断言在 JMeter Scoping Rules 之后,因此单个断言将应用于其范围内的所有采样器:
我是 jmeter 的新手,想知道是否可以从中央位置调用自定义断言消息。
Thread group 1
http sample
xpath extraction
custom assertion message
Thread group 2
http sample 1
xpath extraction
custom assertion message
http sample 2
xpath extraction
custom assertion message
自定义消息使用xpath提取获取响应代码,如果返回成功消息代码则忽略自定义消息。
如果响应代码不是成功响应,我们提取实际响应代码并在自定义断言消息中使用。
我想改为从一个中央位置调用自定义消息。
自定义断言如下:
if (!"SuccessResponseCode".equals(vars.get("xpathResponseCode")) && prev_result != null){
AssertionResult.setFailure(true);
AssertionResult.setFailureMessage("The response code is "+vars.get("xpathextractionResponseCode").toString()+" and the expected is expectedResponseCode"+ctx.getThreadGroup().getName()+" test case.");
}
所以我想调用外部自定义消息
自定义断言
线程组 2 http 示例 1 xpath提取 JS232 - 调用自定义消息 http 示例 2 xpath提取 JS232 - 调用自定义消息
只需将您的断言放在与 Thread Groups 相同的级别即可。
断言在 JMeter Scoping Rules 之后,因此单个断言将应用于其范围内的所有采样器: