In this tutorial, I will show you how to use IntelliJ IDEA to write Katalon Studio tests. Similar results can also be accomplished with other IDEs (Eclipse, VSCode) that understand the Eclipse project structure.
Please note that this is not an official feature. Use this only if you really prefer your IDE.
I hope this will somewhat help address a number of requests from Katalon Studio users, for example:
Scripting, Executing, and Debugging
My IntelliJ IDEA version is Community 2018.2, which is available for free at the JetBrains website.
You will also need Java SE Development Kit 8 and Groovy SDK 2.4.12 (I haven’t tried other versions).
After installing IntelliJ IDEA please install two plugins Eclipse Integration and Groovy. Remember to configure your Java SDK and Groovy SDK.
For this tutorial, I’ll use the JIRA UI Tests samples.
After open this project with Katalon Studio, please run the test case you want to work with. In this tutorial, it is Test Cases/Simple Examples/Login Test/Data-driven examples/Login with username and password as a default value of variables. This step is required to make sure Katalon Studio has generated all necessary files.
Please leave Katalon Studio open after this step.
Now we can import the project into IntelliJ IDEA. I’ll skip some steps since I only use default options.
Open the temporary file generated by Katalon Studio in the previous step. If you see the yellow notification bar, just follow in-app instructions to configure Groovy SDK for this project.
Then you can right-click the file and select Run… menu item.
It’s also possible for you to set breakpoints and run the debugger. Again, just right-click and find the Debug… menu item.
The Variables tab of IntelliJ IDEA debugger is quite handy to try out some commands in REPL style.
Scratches
Scratches is where you can test your newly written code very quickly. For demo purpose, I’ll add a simple Custom Keyword named sum()
into the JSelect
class.
Now create a new Groovy script in Scratches to quickly verify the Custom Keyword. Right-click on the script and find the Run… menu item.
Writing JUnit Tests for Custom Keywords
Katalon Studio includes the JUnit 4 testing framework, so it’s possible to use JUnit to test your Custom Keywords. All tests should be placed at Include/scripts/groovy. Running JUnit tests are supported by IntelliJ IDEA.
For more details on how to write JUnit tests in Groovy, please read the official documentation.