I’ve seen this reported before and there was no response from Katalon development.. and the temp solution provided by other users does not work.
I am unable to send API request due to sendRequest is not being recognized…but sometimes the request does go thru. This is strange.
This is blocking us from implementing API tests properly. This keyword was working awhile ago. Am I missing something here?
if i get rid of the (findTestObject … then sendRequest is no longer underlined… i don’t know if that’s how it is now.. but this does not work.
If you change your code as follows, the underline will disappear
ResponseObject response = WS.sendRequest((RequestObject)findTestObject('API Web service/POST resetFS folder' , [('de_url'): '......']))
Rational:
WS.sendRequest(arg0) requires an instance of com.kms.katalon.core.testobject.RequestObject as the argument
findTestObject(String) method returns an instance of com.kms.katalon.core.testobject.TestObject.
therefore the Test Case editor detected a type mismatch, hence warned it by underlining.
RequestObject class is a subtype of TestObject.
So you can cheat the Test Case editor by casting a TestObject returned by findTestObject(...) to a RequestObject.
Please note, this underline is not very significant. It is just a warning emitted by the editor. It is possibly not the reason why you test case fails. Even if the underline is erased, you test case may still fail due to some reason which is not yet looked at.
1 Like
In my humble opinion, it would be better if I could write the code as follows:
import static com.kms.katalon.core.testobject.ObjectRepository.findRequestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
ResponseObject response = WS.sendRequest(findRequestObject('API Web service/POST resetFS folder', [('dev_url'): '....']))
I mean, we need the ObjectRepository to implement findRequestObject method which returns an instance of RequestObject. With it, no type-casting will be required.
Unfortunately findRequestObject method is not provided actually.
c/c @duyluong
1 Like
ashraf.madina:
but this does not work.
This tells nothing to others.
Please provide more information: logs, screenshot, your test case script, test object definition, the target URL if it is public etc. See the following guidance.
My test is BROKEN! NOTHING WORKS! HELP ME!
Relax. We get it. We really do. There are some pretty smart and clever people on this forum, but you must realize, they are not magicians or wizards or gods. They cannot see your code, they can’t see your errors and they don’t even know what your AUT is meant to do even though it might seem perfectly obvious to you.
So please relax and follow the advice below, before you start writing your post. The advice below will tell you the exact information …
kazurayam:
(RequestObject)
This worked. I figured it out before but forgot to update the thread. But credits to you nonetheless.
system
Closed
September 21, 2022, 1:02pm
7
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.