调用 jmeter 函数时出错 ${__time(MMddHHmmss,"variable"}

Error at calling jmeter function ${__time(MMddHHmmss,"variable"}

我需要 10 个位置的日期,但是当我调用上面的函数时。

收到错误:

2020-08-13 12:10:12,460 ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script JSR223 Sampler, message: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.call() is applicable for argument types: (java.lang.Integer) values: [813121012]
Possible solutions: wait(), any(), abs(), wait(long), wait(long, int), max(int, int)
javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.call() is applicable for argument types: (java.lang.Integer) values: [813121012]
Possible solutions: wait(), any(), abs(), wait(long), wait(long, int), max(int, int)

不要将 JMeter Functions or Variables 内联到 Groovy 脚本中,您有 2 个选择:

  1. 要么使用 JSR223 测试元素的“参数”选项卡

  2. 或者生成日期 purely in Groovy,例如:

    vars.put('variable',new Date().format('MddHHmmss'))
    

更多信息:Apache Groovy - Why and How You Should Use It