调用jmeter函数$ {__ timeMMddHHmmss,“ 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(),int)

解决方法

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

  1. 要么使用JSR223测试元素的“参数”标签,要么

    enter image description here

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

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

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...