Hi,
Maybe I'm taking the wrong approach here but I'm trying to create JSON
object nicely with a JSR223 preprocessor and provide it to the actual HTTP
Sampler.
As JSON is native to java script, I am trying to use the javascipt language
in the JSR233 pre-proc.
All is fine, but once I put the resulting JSON into a variable using
vars.put() it is rendered as [Object][Object] in the actual HTTP sampler.
When I try to stringify the object prior to saving it with the
JSON.stringify() I get the following error:
ERROR - jmeter.modifiers.JSR223PreProcessor: Problem in JSR223 script
javax.script.ScriptException:
sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "JSON" is
not defined. (<Unknown source>#6) in <Unknown source> at line number 6
at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
at javax.script.AbstractScriptEngine.eval(Unknown Source)
at
org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:202)
at
org.apache.jmeter.modifiers.JSR223PreProcessor.process(JSR223PreProcessor.java:42)
at
org.apache.jmeter.threads.JMeterThread.runPreProcessors(JMeterThread.java:749)
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:414)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
at java.lang.Thread.run(Unknown Source)
So obviously JSON is not defined in the scope of the pre processor.
Any ideas on how to create nicely JSON objects in jmeter?
(As I don't have the same json payload / structure, I must dynamically
create it inside the script)
Best,
Shmuel Krakower.
www.Beatsoo.org - re-use your jmeter scripts for application performance
monitoring from worldwide locations for free.
Maybe I'm taking the wrong approach here but I'm trying to create JSON
object nicely with a JSR223 preprocessor and provide it to the actual HTTP
Sampler.
As JSON is native to java script, I am trying to use the javascipt language
in the JSR233 pre-proc.
All is fine, but once I put the resulting JSON into a variable using
vars.put() it is rendered as [Object][Object] in the actual HTTP sampler.
When I try to stringify the object prior to saving it with the
JSON.stringify() I get the following error:
ERROR - jmeter.modifiers.JSR223PreProcessor: Problem in JSR223 script
javax.script.ScriptException:
sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "JSON" is
not defined. (<Unknown source>#6) in <Unknown source> at line number 6
at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
at javax.script.AbstractScriptEngine.eval(Unknown Source)
at
org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:202)
at
org.apache.jmeter.modifiers.JSR223PreProcessor.process(JSR223PreProcessor.java:42)
at
org.apache.jmeter.threads.JMeterThread.runPreProcessors(JMeterThread.java:749)
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:414)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
at java.lang.Thread.run(Unknown Source)
So obviously JSON is not defined in the scope of the pre processor.
Any ideas on how to create nicely JSON objects in jmeter?
(As I don't have the same json payload / structure, I must dynamically
create it inside the script)
Best,
Shmuel Krakower.
www.Beatsoo.org - re-use your jmeter scripts for application performance
monitoring from worldwide locations for free.