I’ve made a sample project using JMeter to perform API testing with Katalon Studio. There were some requests to integrate JMeter with Katalon - I hope this sample will help.
Install gradle
Please follow official instructions by Gradle.
Pulling JMeter dependency
Creating a build.gradle file in your project then run the following command to download jmeter dependencies.
gradle katalonCopyDependencies
Create JMeter Runner
You need to download JMeter then extract the bin folder to Include directory in katalon project
In Include/scripts/groovy, we create JMeterRunner (JMeter Runner configuration class) and KatalonSamplerClient, which will execute katalon testcases and returned results.
JMeter is ready, let’s make a run now.
Define a custom jmeter keyword, which will new the runner above.
Create a JMeter Testcase, call the jmeter keyword then enjoy your results.
Thank you for the sample project. When I run the sample project with simple web page ping test case, I get empty result csv file and empty html file. Below is part of result that shows summary of 0 item.
Could you please advise on this?
19-07-11 16:55:45.184 INFO c.k.k.core.main.WSVerificationExecutor - END Verification
2019-07-11 16:55:45.185 INFO c.k.katalon.core.main.TestCaseExecutor - END CALL Test Cases/Ping Test Case
2019-07-11 16:55:45.185 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
summary = 0 in 00:00:00 = ******/s Avg: 0 Min: 9223372036854775807 Max: -9223372036854775808 Err: 0 (0.00%)
ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property ‘log4j2.debug’ to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
Test completed. See test.jtl file for results
Open test.jmx file in JMeter GUI to validate the code
I am trying to follow the guide in order to run jmeter in Katalon but when I run the jmeter test case, it fails.
Below the issue :
Test Cases/JMeter Test Case FAILED.
Reason:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/Users/lauriam/Documents/myProjects/katalon-jmeter-sample/Scripts/JMeter%20Test%20Case/Script1549599512743.groovy: 18: unable to resolve class com.katalon.jmeter.KatalonJMeterRunner
@ line 18, column 1.
import com.katalon.jmeter.KatalonJMeterRunner as KatalonJMeterRunner
^
1 error
at com.kms.katalon.core.main.ScriptEngine.getScript(ScriptEngine.java:199)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1586967969748.run(TempTestCase1586967969748.groovy:23)
Could you please create a new topic with bug report template for investigation? Your post above does not give sufficient information for us to support you. Thanks!
Hey Guys, HI @Thong, @Jass… It is not normal all these difficulties for more users.
Maybe, I missing somethings, I try step by step as I had done:
0) Use Windows 10 pro, 64. Katalon studio 7.9.0.
I can follow all steps, after a lot of trial and error to include implied and missing steps. However, “define custom jmeter keyword” is vague. I’ve found some implementations of this keyword from other users, but none which include a createSampler method.
As someone who is not a user of JMeter, maybe I am missing what is implied here. Can someone please add the keyword to the sample project? The project can’t run without it.