I followed below steps for migration of a piece selenium TestNG code to Katalon studio. Am getting error while running the TC. Please help me understand what I am missing here pre-requisite: Added Selenium/TestNG plugin
Copied selenium code under Include /Scripts/groovy/package/test.java and pageobject under same package
Imported all the related libraries manually under Project/settings/External libraries since not aware of format to add maven libraries into build.gradle
Created a TC and added TestNG Keyword to call the java class as follows
List testClasses =[âtest.classâ]
TestNGKW.runTestNGTestClasses(testClasses)
Getting below error while running the TC
Test Cases/IdentifiAppl/SeleniumLoginScript FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Keyword runTestNGTestClasses was failed (Root cause: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object âtest.classâ with class âjava.lang.Stringâ to class âjava.lang.Classâ due to: java.lang.ClassNotFoundException: test.class
Imported all the related libraries manually under Project/settings/External libraries since not aware of format to add maven libraries into build.gradle
Created a TC and added TestNG Keyword to call the java class as follows
List testClasses =[âIdentifiLogin.classâ]
TestNGKW.runTestNGTestClasses(testClasses)
Getting below error while running the TC
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object âIdentifiLogin.classâ with class âjava.lang.Stringâ to class âjava.lang.Classâ due to: java.lang.ClassNotFoundException: IdentifiLogin.class
07-28-2020 08:32:51 PM Test Cases/IdentifiAppl/SeleniumLoginScript
Elapsed time: 2.877s
Test Cases/IdentifiAppl/SeleniumLoginScript FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: IdentifiLogin for class: Script1595830441555
at SeleniumLoginScript.run(SeleniumLoginScript:19)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
If you want to use gradle to manage external libraries, you should install gradle binary first like @kazurayam said.
However, if you use selenium-java:3.141.59 and its dependencies only, you donât need to do this step because Katalon Studio already bundles selenium-java:3.141.59.
Just copy your Java source code to Include/scripts/groovy and enjoy Katalon.