Failed test case shows 200 as status code

Code

import static org.assertj.core.api.Assertions.*

import com.kms.katalon.core.testobject.RequestObject

import com.kms.katalon.core.testobject.ResponseObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webservice.verification.WSResponseManager

import groovy.json.JsonSlurper

import internal.GlobalVariable as GlobalVariable

RequestObject request = WSResponseManager.getInstance().getCurrentRequest()

ResponseObject response = WSResponseManager.getInstance().getCurrentResponse()

WS.verifyResponseStatusCode(response, 200)

assertThat(response.getStatusCode()).isEqualTo(200)

WS.verifyElementPropertyValue(response, ‘data[0].first_name’, ‘Michaels’) —the data I am passing here is wrong .

Execution says fail but the status says 200.

Expected : should that not show as 404 (Data not found )

No, that is correct as your call itself returned a valid result.
When you check inside the result later if your values match that is something else.

But as long as you get a valid result e.g. json or xml than the status of the response should be 200. When there was no result in case you did not send the correct request you get a 4xx or 5xx :slight_smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.