Groovy script in JMETER

I was trying to add groovy (Groovy 2.4.3) to JMeter 2.13.

I am placing all% groovy_home% / lib / .jars in% java_home% / lib / ext / groovy -lib / .jar

I added the classpath in jmeter.property file (search_paths = / lib / ext / groovy -lib)

The problem is that after starting JMeter, I can use groovy on BSF items (Assertions, Samplers, etc.), but JSR223 items (Assertions, Samplers, etc.) do not show the groovy script language setting.

BSF Showing Groovy

JSR223 Missing Groovy

Any help would be helpful Thanks

+3


source to share


3 answers


The easiest and easiest way to download and run groovy:



  • Download the latest groovy -all.jar from Maven
  • Drop it into the / lib folder of your JMeter installation./lib/ext is actually for the core and JMeter extensions)
  • Restart JMeter if it works (jar grabbing process is not dynamic, it also applies to any other libraries like Jmeter Plugins , JUnit tests , modifying the user.properties file, etc.)
  • After reboot, you should see groovy along with the .jar version in parentheses
+6


source


You have to use user.classpath and groovy -all-xxx.jar

List of paths that JMeter will search for utility and plugin dependency classes. Use the platform path separator (according to the " path.separator " system property ) to separate multiple paths. The path element can be a jar file or a directory. Any jar file in such a directory will be automatically included. Jar files in subdirectories are ignored. This value is in addition to any jars found in the lib directory. All entries will be added to the system class loader classpath as well as the internal JMeter loader path. Paths with spaces can cause problems for the JVM



So it should be:

user.classpath = / Library / int / groovy -lib / groovy -all-xxx.jar

+4


source


You can also install the utility JAR files in $ JAVA_HOME / jre / lib / ext, or you can set the user.classpath property in jmeter.properties

Note that setting the CLASSPATH environment variable will have no effect. This is because JMeter is started with "java -jar" and the java command silently ignores the CLASSPATH variable and -classpath / -cp options when using -jar. [This happens with all Java programs, not just JMeter.]

According to this , but it did the magic for me: Just edit the user.classpath property in jmeter.properties.

user.classpath = "OUR GROOVY -home-DIR" / Library

Surprisingly, using $ GROOVY_HOME didn't help, and I should have mentioned groovy home path instead of referencing the system environment variable and @ ubik-load-pack , if you need more items to add to this property, use your operating system classpath separator ( Linux = ":", Windows = ";")

0


source







All Articles