Ask a Question

Testing negative scenarios


Testing negative scenarios



I have come across scenario, where I need to test negative scenarios for API. For my API testing i need to test for scenarios where in some cases API gives response with error code(Which I am able to validate and test) but some are invalid request format.


If i need to test these all scenarios for 1 API where some are returning API response with error code and some are invalid request.

1. How can i put assertions with Or Condition

2. How to assert if API has invalid request


Champion Level 2

Please provide some example data for better understanding of the question.


For example:

case i)

If I input wrong input data for adding account balance to account and I don't pass amount, it gives me response on API saying amount should be entered.  

case ii)

If I don't pass Account number, API gives error(not response) saying "The server encountered an error processing the request. .... "


Now I can put assertions on case i, for some error message and error number, but as I am not getting any response in case ii, can i put some assertions? if yes how?

Showing results for 
Search instead for 
Did you mean: