I really hope that I my question has been already covered by someone else. What I’d like to know is when to use Custom Keywords and when Methods. What is their special purpose?
Some differences I figured out so far are
A Custom Keyword cannot call another one <-> methods can call other methods
Keywords need an anotation, methods not
When calling a Custom Keyword the sysntax looks a bit complex with
CustomKeywords.'package.class.keyword'(params)
Due to this it seems to be better to use methods all the time. But Im sure there are reasons to use the Custom Keywords
The only reason to use @Keyword methods is so that non-programmers can choose them from a list in Manual View. If you’re comfortable in Script View, create regular methods (perhaps make them static) and import your package/classes where you need them.
BTW, you can call one @Keyword from another but then you’re mixing intentions and purposes (rarely a good idea).
Is there a way to create a public static method that you can call in any test case? I figured keyword was the only way to do this. I don’t see the package structure for creating test cases.
Is there a way to create a public static method that you can call in any test case? I figured keyword was the only way to do this. I don’t see the package structure for creating test cases.
Create a package, my_package.
Add a new class to the package, my_class:
package my_package
public class my_class {
...
}
Add a new static method my_method to my_class:
public class my_class {
static void my_method(/* params here */) {
// do remarkable things
}
}
where would this go though? I don’t see where packages and methods are stored in katalon. I know how to do this with eclipse IDE but in Katalon, we have test cases and keywords. do I need to add something for having packages?
I would like to use it as the import statement we have in katalon like the complete import statement I am using by alias name right, I am not really sure, if its possible or not… just wanted to know.