Introduction to Custom Keywords


This is a companion discussion topic for the original entry at


If you want to use Custom Keywords in a “Step Definition” .groovy file, what “import” package do you use?


I have run into the same problem. Have you found a solution for this?


Say your custom package is in Keywords/my.keywords/myCustom.groovy and that the class is called myCustom and that there is a method named 'myMethod()` inside the class.

In which case you would add:
import my.keywords.myCustom()

To use myMethod() you would then need:

myCustom x = new myCustom()

I tend to declare the class at the top of my scripts as a static, then you can use it throughout the script as an alias. Eg.

private myCustom mc = new myCustom
def blahh () {

I hope that helps