05-30-2018 02:59:02 PM - [INFO] - Finding Test Object with id ‘Object Repository/HelpDeskModule/Master/Team/Page_eFACiLiTY/input_Txt_Code’
05-30-2018 02:59:02 PM - [ERROR] - No such property: CustomKeywords for class: mandatoryfield_Validation.Mandatoryfieldvalidation
05-30-2018 02:59:02 PM - [END] - End action : mandatoryfield_Validation.Mandatoryfieldvalidation.textfieldvalidation
05-30-2018 02:59:02 PM - [ERROR] - Test Cases/HelpDeskModule/Master/Team_/Team FAILED because (of) Variable ‘CustomKeywords’ is not defined for test case.
Here is my snippet:
public class Mandatoryfieldvalidation {
//
private static Connection connection = null;
private static String columntype;
private static int num;
private static int datatypevalue
def driver = DF.getWebDriver()
KeywordLogger logger = new KeywordLogger()
JavascriptExecutor js = ((driver) as JavascriptExecutor)
The first issue I noticed with your code snippet is the single-quotes after CustomKeywords. The documentation here shows they are not needed and would probably cause your keyword reference to be treated as a string. CustomKeywords is not a function, so it would not take parameters.
Second, you might need to reference the “alerthandling” package within the new package. Check the import section of a Test Case that uses one of your custom keywords to see if it has a line for CustomKeywords.
Another idea would be to combine the two packages. That should guaranty that you can reference “verifyalertpresent.verifyalert” within Mandatoryfieldvalidation…
I’m no expert in Katalon Studio, but since you had no other replies yet, I though I would offer some ideas. Best of luck!
Try to call directly _alerthandling.verifyalertpresent.verifyalert() _method. CustomKeywords is not a class, it is just a kind of Groovy wrapper for custom keywords.
As Marek mentions, CustomKeywords are not really a class - they are a set of auto-generated functions (from your custom classes) that live in a CustomKeywords.groovy file. That file is loaded by Katalon test files at run time.
It appears that you only need to access CustomKeywords using the quotes when using them in test files.
From other CustomKeyword files, you can access the classes/functions directly, just like you would if you were programming any other groovy library or application.
I receive the following error on a test case using the keyword
Test Cases/playground/RQC_navigate FAILED because (of) Variable ‘utilities’ is not defined for test case.
Any help? Sorry, i am new to the Java world. I have had a lot of success using keywords, but this is my first time trying to call one from a different package.
HI, I ran into the same issue, but when i apply the magic solution below, it seems that the function/method is not ran and the test case passes. It ignores this line it seems
new clientAccount.ClientAccount().getRowColumnTable(GlobalVariable.switchToClientAccount)
@Keyword
def verifySuccessfulLogin(String username){
//if(WebUI.verifyOptionPresentByLabel(findTestObject(adminIdentityProvider), ‘Yahoo!’, false, 10, FailureHandling.OPTIONAL)){
if (WebUI.verifyElementPresent(findTestObject(cloudAdmin), 0,FailureHandling.OPTIONAL) && (WebUI.verifyElementPresent(findTestObject(username), 0,FailureHandling.OPTIONAL))) {
KeywordUtil.markPassed(‘SUCCESS: Login to the web portal was successful’)
} else {
println(‘ERROR: Login to the web portal was unsuccessful’)
//switch to Cloud admin account in case another account type is logged in using the same email address
new clientAccount.ClientAccount().getRowColumnTable(GlobalVariable.switchToClientAccount)
}
}