I create a new custom keyword SetText, how can I map this custom keyword SetText to builtin keyword SetText?
If we have no mapping, we have to manually modify builtin keyword to custom keyword when we have a new record.
I suppose meta programming in Groovy can help with this ?
What do you mean âmap this custom keyword to the builtin keywordâ?
Do you want to completely replace the implementation of WebUI.setText(TestObject) with the one you created?
Why do you want to do it? You can call your one by one line: CustomKeywords.'your.package.YourClass.setText'(TestObject). Why isnât it enough?
Anyway, the following Katalon Studio project of mine may give you some hint:
Especially the pandemic() method of
shows an example of applying Groovy metaprogramming technique to modify the behavior of Katalon Studioâs built-in keywords.
I need to always manually modify builtin keyword to my custom keywords when I use katalon to record a new testcase, which katalon will use the default builtin keyword . If I do that,it will be waste of time.
Thanks for you reply, itâs very helpful for me 
thanks, maybe it will be helpul for me
How can I map a custom keyword (e.g., clickkeywordJS.groovy) to a built-in keyword (e.g., click)
Hi there,
Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.
Thanks!
The above statements give you some info on mapping keywords. However, since you are working recording in the Manual mode, you probably should not be âmappingâ your new keyword method to some other default method, yet. Read kazurayamâs response on âmappingâ on your other question on this topic.
Edit: you can easily use âSearch and Replaceâ after the fact with CRTL + F.
Start by reading the below link to create your custom keyword (donât forget to put the phrase @Keyword above your method). Once you have created your custom keyword(s), you will be able to select it/them from your list you make. The below link tells you how.
Introduction to custom keywords in Katalon Studio | Katalon Docs
Sample:
@Keyword
def clickKeywordJS() {
...
}
Edit: when you start to create a new keyword, KS allows you to create several âdefaultâ methods. If you accept the âdefaultâ methods, you can see what I mean how to create keywords properly, by example.
Have you already created a lot of Test Case scripts using Web Recorder that call WebUI.click() and/or WebUI.enhancedClick() ?
If so, you have a good reason why you require the âmappingâ. You would want to avoid rewriting the scripts if possible. With the âExpando meta classâ technique, possibly you can reduce the volume of code rewrite job.
Hi @grylion54,
I mean how to replace a custom keyword which I created to run the click button. My default button (Click - build-in) did not work.
And now I want to override the custom keyword with our default click in every test case. Please note that I prefer to use the âRecord Modeâ.
I have done it with a Test Listener (overclick) and a groovy function.
Thank you!