English 中文(简体)
使用用户变量和正则表达式的Jmeter断言
原标题:Jmeter assertions using user-variables and regex
  • 时间:2012-05-25 17:01:17
  •  标签:
  • regex
  • jmeter

我正在使用jmeter运行一系列Web服务测试,遇到了几个关于断言的问题。基本上,在我的一个请求中,需要指定错误分类(变量${CLASS}),并且该请求应该返回具有指定错误的订阅者和设备的信息。我想断言,与其他信息一起返回的分类永远不会不是输入的分类。即分类=“${CLASS}”。我很确定我想在断言中使用RegEx和jmeter的not contains选项来实现这一点,但我不太确定如何使其工作。非常感谢您的帮助!

最佳回答

根据您的评论,我建议使用多个断言。如果你有多个断言,只有当所有断言都通过时,父请求才会通过,一旦任何一个断言返回失败状态,它就会失败。

例如,你可以有一个如果找到“次要”则返回通过状态的程序,另一个如果没有找到“主要”则返回通行状态的程序。您可以通过选中“模式匹配规则包含”复选框“未选中”,然后简单地包含您不希望作为测试模式出现的文本,来指定如果断言找到文本,则断言将失败。

您也可以在同一断言中有多个文本字符串,但就像这样,它们都将使用相同的范围和模式匹配规则。

问题回答

暂无回答




相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...

热门标签