如何在Jmeter中添加正则表达式

时间:2017-11-30 06:04:35

标签: jmeter

如何为后续post方法添加正则表达式提取器以获取摘要值。

<form method="post"
action="ModuleQuickMenu.aspx?mid=65&digest=nvBKUwJ18A66j4IJl7ppGA"
id="form1">

1 个答案:

答案 0 :(得分:0)

请记住,您需要在正则表达式中转义BaggingClassifier符号,以便它类似于:

const data = [{"user":1,"car":"volvo","score":7,"time":"some time"},{"user":2,"car":"volvo","score":8,"time":"some time"},{"user":3,"car":"volvo","score":9,"time":"some time"},{"user":3,"car":"opel","score":6,"time":"some time"},{"user":3,"car":"honda","score":8,"time":"some time"},{"user":4,"car":"volvo","score":6,"time":"some time"},{"user":4,"car":"opel","score":7,"time":"some time"},{"user":5,"car":"honda","score":8,"time":"some time"}];

let res = []
data.forEach((item) => {
  if (res.length === 0) {
    res.push({[[item.user]]: [item.score]})
  }else {
    let index = -1;
    res.some((obj, i) => {
      if (Number(Object.keys(obj)[0]) === item.user) {
        index = i
        return true;
      }
      return false;
    })
    if (index !== -1) {
      res[index][item.user].push(item.score)
    } else {
      res.push({[item.user]: [item.score]})	
    }
  }
})

console.log(res)

演示:

JMeter Regular Expression

参考文献: