Every tester, either manual or automated one, constantly thinks about the so-called “happy path” – a perfect test script that will definitely be used by an end-user during his/her interaction with the suggested software.
While working on test automation, the testers hope that all UI tests will be automated, and during the API testing, every part will return with “200 OK” or with another successful response.
But we shouldn’t also forget about negative testing – either while performing manual or automated testing. The reason is the following.
Any automated tests can be executed for the wrong reasons
We may wonder how this can happen but sometimes there are situations when the tests return with successful results but actually are not really informative.
In this case, it’s very important to check not only the possibility of test failure but also the accuracy of such a failure. This approach will help to check the things that were primarily planned to be tested.
Negative testing can help to find incorrect bug processing
For example, during the API testing, any user error must return with the responses of the 400th level, not the ones of the 500th level.
If while executing negative testing, the errors of the 403rd level are displayed as the ones of the 500th level, we can say for sure that a software code stopped managing a programmed use case.
Receiving the 500 response from a server’s side can prevent a client from getting the data needed for the bug fixing – or an app can even break.
Negative testing can help to find possible security weak spots
We should check that a client can’t access his/her personal account in an app if he/she is not allowed to do this; it’s as important as to be sure that an automation process runs smoothly. If we check only valid values, we can miss executing the most important tests.
We should also check that a particular group of users has no access to the special app’s functionality. A properly tested admin panel can be almost useless if it can be accessed by a user with the “editor” rights.
Negative testing keeps the database clean
If an app contains only valid data, the state of such a product will be really good. The information which doesn’t meet the technical requirements can lead to the page’s breakage or stop loading the system load (or the information will be displayed incorrectly).
The more negative tests will be executed for inputting, the more confidence in the fact that the data are absolutely valid and correct a responsible tester will have.
Sometimes users unintentionally perform negative testing
It’s very easy – especially while testing a new feature to meet the fixed deadline – to forget to test the use cases when a user clicks on the “cancel” or “delete” buttons (for example, the “Feedback” form). But humans permanently do such things – since it’s not rare that you made an order on the online store, added a product to a cart and then changed your mind and deleted everything.
Anyway, the process of testing is consistent searching for an unexpected system behavior to find more bugs than a software user can find. When the process of negative testing on the projects is combined with “happy path” testing, we can be completely sure that a client won’t face unexpected surprises.