正确使用匹配器用于jmeter变量

时间:2012-06-07 14:59:51

标签: variables jmeter

我需要在表格中计算行数。所以我用reg。进出口。提取。但响应断言以错误结束,并试图找到rows:${ROWS_matchnr}

我试过谷歌,但我只找到一些非功能性建议。

Thread Group
    Http Cookie Manager
    Http Request
        Regular Expression Extractor(ROWS, row-(.*), $1$, 0, )
        Response Assertion(rows:${ROWS_matchnr})

1 个答案:

答案 0 :(得分:1)

将Match No字段中的值从0更改为-1。正如ahem所述,useless official help

If the match number is set to a negative number, then all the possible matches in the sampler data are processed. The variables are set as follows:

   refName_matchNr - the number of matches found; could be 0
   refName_n, where n = 1,2,3 etc - the strings as generated by the template
   refName_n_gm, where m=0,1,2 - the groups for match n
   refName - always set to the default value
   refName_gn - not set

然后将$ {ROWS_matchnr}更改为$ {ROWS_matchNr}(大写N),它应该有效。

如果您仍有问题,请使用Debug Sampler查看正则表达式返回的内容。