How to develop Custom Keywords Plugins

Dear guys,

Previously, we have announced a tutorial to build standard plugins for Katalon Studio.

In this post, we’ll introduce a more lightweight process for sharing custom keywords as plugins.

  • Custom Keyword plugin is available since Katalon Studio 6.0.6.

Develop a Custom Keywords plugin

  • Sample: GitHub - katalon-studio/katalon-studio-excel-keywords-plugin.
  • A Custom Keywords plugin is essentially a normal Katalon Studio project with some Custom Keywords implementation. So the steps are quite simple:
    • Create a new Katalon Studio project.
    • Implement your Custom Keywords.
    • Test Cases can be added to help verify these Custom Keywords and to serve as samples for plugin users.

Package the Custom Keywords plugin

  • In the Keywords folder, add a katalon-plugin.json file with the following format:
{
  "keywords": [keywordClass1, keywordClass2]
}

Example:

  • In the project’s root folder add a build.gradle file

Install Gradle and run the following command, then checking the build/libs for the plugin’s JAR package.

gradle katalonPluginPackage

Note: If you run the above command inside an existing project, please open that project with Katalon Studio first.

Test the Custom Keywords plugin

Publish the plugin

Once you’re done developing your plugins, please submit them to Katalon Store. We’ll review your contents against our policies before approving to list them on the Store.

Sample plugins

Best regards,

3 Likes

I have junit4ks project where I developed a Custom Keyword com.kazurayam.junit4js,JUnitCustomKeywords#runWithJUnitRunner. I believe it is useful for those who like unit testing using JUnit4. I want to make it a plugin and share it with them. I understand the procedure described above. I would be able to make a jar file on my machine.

I have a question. How can I share the jar with others?

One idea would be to ask them refer to my Github’s projects’ Releases page to donwload the attached jar. It would work. But I think it is not enough.

I want Katalon to provide some repository service like Maven central or jCenter from which any Katalon user download my junit4ks.jar once published. Is “Katalo Store” fitting to this purpose?

Yes, Custom Keyword plugins will be shared in Katalon Store - we are working on this function.

And thank you for sharing your JUnit Custom Keywords :smiley:.

1 Like

I do not like this portion.

Gradle has a standard task named install. By executing > gradle install, one can publish the associated artifacts (pom and jar) to the local Maven cache. And I would prefer copying the junit4ks.jar from the local Maven cache into my new Katalon project’s Plugin folder by some command like > gradle dependencies or > gradle katalon-dependencies.

More questions.

It is not enough if I publish a custom keywords in jar without associated materials such as

  • sample test case script
  • README.md document
  • associated Test Listener code, Test Objects, and much more

How can I publish those materials with junit4ks.jar?

I got an issue when I open katalon project including file .jar in the folder Plugins. I’ve followed steps as guideline to build file .jar and test a custom keyword plugin but fail to do another one. The error message is:
katalon-plugin-issue

HTMLTable.jar.zip (89.0 KB)

Could you please help me on this. Thanks

Hi @mytruong,

Currently, we don’t support overloading custom keyword functions. We will release an enhanced version soon. Thanks.

Thank you @kazurayam for your feedback.

There will be a field for each plugin to specify their Github repositories. Companion materials can be provided their. @YoungNgo has updated the original post to include guidelines for publishing.

Test Listeners, Test Objects, etc. will be handled soon in the next version.

Let try to change the declare data type of method: def instead of List<{dataType}>
For example at line 91 in WebTableHelper class: private static List getSelectedOptions(List selects)
Please change it to: private static def getSelectedOptions(List selects)

I made junit4ks-all.jar.

I created a brand new project using Katalon Studio 6.0.6. I. I created Plugins directory in the root directory of the project. I copied the junit4ks-all.jar into the Plugins diretory. I reopened the project, and then I got the “Unable to open project” error dialog as follows:
UnableToOpenProject

I attached the junit4ks-all.jar (renamed to be *.zip because this forum site rejected *.jar file to be attached)
junit4ks-all.jar.zip (37 KB)

Please help fixing this error.

I want to generate the Javadoc/Groovydoc of junit4ks-all.jar and publish it in the Katalon Store, as I can pushlish the javadoc under the /docs directory of my Github project. Please extend the build.gradle to support generating and publishing the Groovydoc of custom keywords.

It works. Thanks a lot

1 Like