Unable to resolve class com.kms.katalon.core.testdata.ObjectRepository

I am getting the following error while executing the test. Can someone please help how to resolve this error ?
Appreciate your help.

Test Cases/CreateAndVerifyPOST FAILED.
Reason:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/C:/Users/spullabhotla/Katalon%20Studio/BctiTestProject/Scripts/CreateAndVerifyPOST/Script1545850092409.groovy: 14: unable to resolve class com.kms.katalon.core.testdata.ObjectRepository
@ line 14, column 1.
import com.kms.katalon.core.testdata.ObjectRepository as ObjectRepository
^

1 error

at com.kms.katalon.core.main.ScriptEngine.getScript(ScriptEngine.java:199)
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:328)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1546468865238.run(TempTestCase1546468865238.groovy:22)

Hi @spullabhotla,

The import line above is incorrect. Please change it to:
import com.kms.katalon.core.testobject.ObjectRepository

Thanks

Thank you very much. It worked. I am new to Katalon. I appreciate your help.
However, how to capture the response, response code and response time. Any thoughts, please ?

Hi @spullabhotla

Here is a sample:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

ResponseObject response = WS.sendRequest(findTestObject('test_object_id'))
println response.getStatusCode()
println response.getElapsedTime() 

For more details, please visit our API document https://api-docs.katalon.com/com/kms/katalon/core/testobject/ResponseObject.html.

Thanks.

2 Likes

Do we have auto import facility?

@Neha.ban

You can press Ctrl + Shift + O for auto import