println() inside static void main
method is not printing anything anywhere, whereas only println() prints in terminal. Here is my code:
class CalcMain {
static void main(def args) throws Exception {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("groovy");
println("testing");
}
}
And when I ran it shows pass (Green Triangle in Jmeter) but doesnt print anything on terminal
Whereas a simple program such as
println("testing");
prints on terminal.
Could some one please let me know where I am doing wrong?
Thanks
Don't use System.out.println in a Groovy or Beanshell step in jmeter. Instead , do this:
1. Enable the stdout console in Jmeter so that you can see the output.
2. Use log.info("Message:" + vars.get("variableName")); instead.
Use below to display text in JMeter Response Tab in "Results Tree":
SampleResult.setResponseData("Document: " + variable,"UTF-8");
Use below to log in the console text area of JMeter:
log.info("hello");
Chapter "2. OUT" shows the answer:
https://jmetervn.com/2016/12/05/jsr223-with-groovy-variables-part-1/
use the
OUT
command.
OUT.println("INPUT MESSAGE HERE");
Try it: System.out.println("testing")
来源:https://stackoverflow.com/questions/19805712/message-is-not-printing-on-the-console-in-jmeter-using-jsr223-and-groovy