Unable to send request (Root cause: java.net.ConnectException: Connection refused (Connection refused))

Hi @Brian_Ducson ,
I am trying to run test send request and verify response for get request test case for REST API TESTING but getting connection refused error.

Reason:

com.kms.katalon.core.exception.StepFailedException: Unable to send request (Root cause: java.net.ConnectException: Connection refused (Connection refused))

at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)

at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)

at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:56)

at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword.sendRequest(SendRequestKeyword.groovy:48)

at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword.execute(SendRequestKeyword.groovy:43)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)

at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.sendRequest(WSBuiltInKeywords.groovy:40)

at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords$sendRequest.call(Unknown Source)

at GetUserList.run(GetUserList: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: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)

URL- https://reqres.in/api/users?page=2
KATALON version:- 5.10.1
I am connected to ethernet and we don’t block anything no proxy.
This error occur every-time when I try to run test case nothing wrong in test case or service.
Service is working fine I tested with postman and its working
I tried other services also but getting same error while running

Following is the test case script:
//Get User list//

GlobalVariable.latest_Response = WS.sendRequest(findTestObject(‘Object Repository/AdvanceProject/GetUserList’))

//Check response contain first name ‘Eve’//

WS.verifyElementPropertyValue(GlobalVariable.latest_Response, ‘data[0].first_name’, ‘Eve’)

WS.verifyResponseStatusCode(GlobalVariable.latest_Response, 200)

//Get User List by Id

GlobalVariable.latest_Response = WS.sendRequest(findTestObject(‘AdvanceProject/getUserById’, [(‘idValue’) : GlobalVariable.idValue]))

def slurper = new groovy.json.JsonSlurper()

def userInfo = slurper.parseText(GlobalVariable.latest_Response.getResponseBodyContent())

println(“This is new response:”+userInfo)

WS.verifyElementPropertyValue(GlobalVariable.latest_Response, ‘data.last_name’, ‘Holt’)

at TempTestCase1548668512759.run(TempTestCase1548668512759.groovy:22)
Please can you take a look and help me .

Thank you

1 Like

Hi,

We have the same problem when running the requuest from office network but it works fine from outside, debugging it more with wireshark we found that the request also goes to update.katalon.com “Production Server”, how to restrict this call.

Thanks
Mohit

1 Like