To answer your first question, it appears that I am actually using 7.9.1. Sorry about the discrepancy.
The import method you have suggested seems to fix this, so I can use this for now.
By the way, the keywords do work as intended, I am just no longer seeing their definitions when hovering over them without using your workaround (sorry about my poorly named function, just giving the most basic example I could come up with)
I’ll move this to bug reports - that’s clearly a loss of functionality.
More about calling the keyword directly…
The only real reason to use custom keywords and @Keyword, is to make them appear in the lists offered by Manual view. If, like me, you live in Script view, you don’t need to write them like that. And if you have a library of utility methods you’d like to use in numerous places, make the methods static and import them statically, too:
public class Myclass {
static void myMethod() {
// do things
}
static void myOtherMethod() {
// do more things
}
...
}
Thanks for the tips. By the way, does this only work for .groovy files and not .java files? When I change the Myclass file from the .groovy to the .java extension, the test case will not run (button is enabled, but nothing happens).
I’m not aware of any such setting. You can certainly have .java files as part of your project, and reference them from test cases, but from what I understand, your test cases must be .groovy files. (Not saying that it isn’t possible to define them as .java, just that I’ve never seen the setting to make that work).
I personally never write Java code in Katalon Studio.
In case I need to develop a fair amount of Java codes for UI testing in KS, I always develop Java codes outside KS. I would design the Java codes completely independent of the com.kms.katalon.** classes, create a jar file, and import the product jar into the Drivers directory of KS project.
Why I do not develop Java in KS?
Firstly, KS is not as good as IntelliJ IDEA as a Java IDE.
Secondly, I think, Groovy language is better fitting for writing scripts for UI testing than Java.
Thirdly, KS forces me a project directory structure which is specifically designed for its problem domain (UI testing by Selenium etc). It is different from the Gradle-conventional directory structure that I like. I feel uncomfortable with KS’s directory structure for Java programming in general. For example, have a look at this path for example: