How can I use a method define in 1 testcase into another testcase?

I defined 1 method “boolean waitForElement(def element, def seconds)” in one test case & I can use it in the same test case without any issue but when I call it from another test case I get below error:

Test Cases/Common/Gmail Login FAILED because (of) groovy.lang.MissingMethodException: No signature of method: Script1527664783509.waitForElement() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.Integer) values: [TestObject - ‘Object Repository/Common/Page_Gmail/input_password’, …]

Test Cases/Common/Gmail Login.run:32

How can I use a method define in 1 testcase into another testcase?

You can create Custom Keyword in Katalon, include your method and then you can reuse this method everywhere in your project.

2 Likes

So that means there is no way to use a method defined in one test case into another test case except creating custom keyword?

I am afraid there is not.