Closed AntonioSun closed 7 months ago
I've just tried it under Linux (Ubuntu 20.04.6 LTS) and I'm getting the same result as well.
Hi, so your test should look like this:
@GrabConfig(systemClassLoader=true)
@Grab('net.simonix.scripts:groovy-jmeter')
@groovy.transform.BaseScript net.simonix.dsl.jmeter.TestScript script
start {
plan {
group {
http 'GET http://www.example.com'
}
// optional element, shows execution progress
summary(file: 'log.jtl', enabled: true)
}
}
The important thing here is the enabled: true property which actually enabled the logging. By default all listeners are off so they don't consume resources when running on test server.
The second thing is the DefaultTestScript you should change it to TestScript as the latter have command line support.
Thanks, I think the new command line support is giving the following errors:
$ groovy example0.groovy --help
Caught: java.lang.NoClassDefFoundError: picocli/CommandLine$ParameterException
java.lang.NoClassDefFoundError: picocli/CommandLine$ParameterException
at net.simonix.dsl.jmeter.TestScript.run(TestScript.groovy:49)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.ClassNotFoundException: picocli.CommandLine$ParameterException
I tried my best to fix it myself
@GrabConfig(systemClassLoader=true)
is there.@Grab('info.picocli:picocli-groovy')
to the top of the script above the other @Grab
.$ cat example0.groovy
GrabConfig(systemClassLoader=true)
@Grab('info.picocli:picocli-groovy')
@Grab('net.simonix.scripts:groovy-jmeter')
@groovy.transform.BaseScript net.simonix.dsl.jmeter.TestScript script
start {
plan {
group {
http 'GET http://www.example.com'
}
// optional element, shows execution progress
summary(file: 'log.jtl', enabled: true)
}
}
please help.
Hi, sorry it seems that I didn't add @ character before GrabConfig.
My original answer is updated.
Ah, I looked at it many times but didn't notice the missing @
, 😊
It's working now. Thanks!!
The important thing here is the enabled: true property which actually enabled the logging. By default all listeners are off so they don't consume resources when running on test server.
Ah, found that it was enabled before when I used the project last time. No wonder all my old scripts seemed to be "stopped working".
Running under Mac:
The typical output on console is not there. How to troubleshoot the problem pls?