API performance testing with Katalon and JMeter

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.
7 Likes

Great!

I haven’t tried it yet, but this is exactly what I need. Thank you!

Hi,

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

Thanks,
Jiho

Please go to the katalon report folder and check if the har files exist. This sample only works with API testing project only

Thank Thong for the reply.

Is there way to use Web testing project? I already built my test project and would like to use the existing one.

@Thong What do you mean by API testing project only? I have a mixed project with UI and API tests in the object repository will this not work?

It will work with your project.

1 Like

Hi! build.gradle file should look like this: https://github.com/katalon-studio/gradle-plugin/blob/master/README.md

how we can create test plan jmeter in katalon?

how to solve this problem

@Thong How can we create this build.gradle with katalonCopyDependencies? can you share sample please.

Also have you tried running plugin on Mac OS?

i tried to run gradle katalonCopyDependencies at the Katalon project directory hitting error.
anything is missing?

An exception occurred applying plugin request [id: ‘com.katalon.gradle-plugin’, version: ‘0.0.4’]

Failed to apply plugin [id ‘com.katalon.gradle-plugin’]
Could not generate a proxy class for class com.katalon.gradle.plugin.CopyDependencyTask.

Hi guys,

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)

Below the project image :

Could someone help me ? Thanks

I’m not able to see the reports at Katalon Reports folder, Can you guys give me a hand?

Hi @lpx ,

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!

Jass

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.

1)Clone the project → katalon-jmeter-sample → OK

2)Install gradle 6.8.1 into C:\Gradle\gradle-6.8.1 → OK

3)Creating Jmeter dependency:
open console CMD → OK
go into folder katalon’s project → OK
type: gradle katalonCopyDependencies

4)download apache-Jmeter 5.4.1 → OK

5)copy the bin folder → OK

6)go my project katalon
C:\Users\XXXXXX\git\katalon-jmeter-sample\

7)paste the foder bin → OK

8)@Thong wrote

but I see into my project


or
I have to move the file JmeterRunner and KatalonSamplerClient where @Thong suggest?

9)i sjust define a custom jmeter keyword

10)test case ok
image

Now I run the test case, but some problems come out


many import statements marked with red underlines, that implies that the jar of JMeter is not included in the buildpath of the project.

Thanks in advanced

I believe, the “max KS version” of the jMeter plugin causes the problem. See

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.