Typically, one would create custom keywords using the Katalon Studio GUI as described in the docs: create a package, store classes in the package and have keyword actions (methods) marked as @keyword
.
Since we want to push Katalon Studio to find its boundaries, I've created a package in a groovy file, defined a class and added @keyword
to its methods, then put it in the /Keywords
folder.
I am now able to call those keywords, and confirmed that each keyword was successfully added to the Libs/CustomKeywords.groovy
file after a project refresh.
Instead, if I add keywords in a file located elsewhere, for instance in the /Include
folders, they are not added to Libs/CustomKeywords.groovy
. Is it safe to assume that Katalon Studio will only import keywords from the /Keywords
folder and, eventually, .jar libraries?
The /Include
folder is where Katalon will check for its BDD files. So, if in /Include/features
there is a feature file with some defined steps, Katalon will search /Include/scripts
for step definition files.
Each Gherkin step in the Features file needs to be defined as a set of programming code so that the machine can execute the actions of these steps. These Step Definitions can be implemented in Keyword folder by leveraging the Script Mode. Katalon Studio built-in keywords can also be re-used in step definition files as well. When Katalon Studio executes any Features files in the test case, it will also look for the matching step definitions in the source folder.
This part
These Step Definitions can be implemented in Keyword folder by leveraging the Script Mode.
may sound confusing, but it is basically saying step definitions can include custom keywords from /Keyword
folder.
That's why I wouldn't put other custom keywords there.
Another place you can put custom code is /Test Listeners
section. That will hold code for SetUp() and TearDown() methods for Test Suites and Test Cases.