How to package Custom Keyword as plugin


#1

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.

Package Custom Keyword plugin with Gradle

{
  "keywords": [keywordClass1, keywordClass2]
}

Example:

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

Run the following command, then checking the build/libs for the plugin’s JAR package.

gradle katalonPluginPackage

Test the Custom Keyword 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.
By the way, the mechanism for Katalon Studio to install and use custom-keyword plugins is still under developing, so bear with us for a short while.

Best regards,


ANT-style file path pattern in katalon-plugin.json
Plugin jar created by the com.katalon.gradle-plugin contains a lot of unintended classes
katalonPluginPackage task failed when executed across platforms
can I create a package in a keyword package?
How to create jar libraries from Custom Keywords?
Excluding specific classes out of the plugin jar
Re-use of Custom Keyword library for other Projects
Excluding specific classes out of the plugin jar
How to resolve external dependencies for a Plugin
#2

#3

#4

#5

#6

#7

#8

#9

#10

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?


#11

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


#12

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.


#13

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?


#14

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


#15

Hi @mytruong,

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


#16

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. @Dung_Ngo has updated the original post to include guidelines for publishing.

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


Is there any way to share test listeners and custom keywords code to multiple projects?
#17

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)


#18

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.


Katalon Studio 6.1.0 Beta
#19

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.


#20

It works. Thanks a lot