Forum Discussion

mgroen2's avatar
mgroen2
Super Contributor
8 years ago
Solved

How to assert on HTTP response code?

I am learning how to write assertions on a REST API , and the responses are Json messages.

 

Now, I would like to create an assertion on the HTTP response code, so I can check if the request is accepted.

For example: inserting an assertion on HTTP 200 OK is a good assertion (I think).

 

My question is. Which assertion type do I need to choose? And what would be the exact code?

 

I can select Invalid HTTP Status Codes, but this only allows me to enter invalid HTTP codes. (if I enter 200 I get an assertion failure with message "200 is in invalid list of status codes" .

 

 

 

 

 

 

 

 

  • SoapUI has two assertion for status codes, Valid HTTP Status Codes and Invalid HTTP Status Codes. Both are in the Compliance category. In your example you need to use Valid HTTP Status Codes.

3 Replies