1

我需要计算表中的行数。所以我使用 reg。exp。提取器。但是响应断言以错误结束,并试图准确地找到rows:${ROWS_matchnr}.

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

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

1 回答 1

2

将 Match No 字段中的值从 0 更改为 -1。正如在,咳咳,无用的官方帮助中记录的那样:

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),它应该可以工作。

如果您仍然有问题,请使用调试采样器查看从正则表达式返回的内容。

于 2012-06-07T15:11:46.053 回答