When i create an API in test repository, it works. i can get the Json response.
but when i use test case to call the api function, it doesn’t work. the error info shows connection timeout.
because i use some basic authorization in my api, so i guess there is something missing in my authorization?
here is the exact code:
RequestObject oAuthTokenRequest = ((findTestObject(‘XXXXXX/AuthTokenUsingPost’, [:])) as RequestObject)
//get oauth token
ResponseObject oAuthTokenResponse = ((WS.sendRequestAndVerify(oAuthTokenRequest)) as ResponseObject)
GlobalVariable.TOKEN = XXXXX.getPropertyValue(oAuthTokenResponse, ‘access_token’)
the error info:
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to send request and verify the response (Root cause: java.net.ConnectException: Operation timed out (Connection timed out)
could you tell me why this happens?
thx.