Negative Testing

In software testing, the following are the main testing strategies-

  • Positive Testing – Positive testing is also known as “Happy Path Testing”. In this testing strategy, by providing valid and correct data, the system’s behavior is checked. Any error or unexpected result is not desired in this testing strategy.
  • Negative Testing – It makes sure the system works smoothly when invalid or unexpected data is entered. It is also known as “An error Path Testing” or “Failure Testing”. Exceptions or errors are desired in this testing strategy.

In this tutorial, we will focus on “Negative Testing”.

What is Negative Testing?

While using any application, it is quite possible that the user may enter invalid data intentionally or unintentionally. Now the system should be smart enough to manage such scenarios. More importantly, the system should not crash in the event of such mistakes.

Negative testing is a type of testing in which a tester intentionally enters invalid data in the system to check the robustness of the application.

When the wrong input is fed to the system, it should show an error message and handle such invalid values gracefully.

One of the examples of negative testing is the testing of the “Contact number” field. “Contact number” field should not accept anything other than numbers. So, while doing negative testing, a tester will try to enter the alphabets or special characters in the ‘Contact number’ field and will check the system’s behavior. The system should display an error message such as “Invalid Value. This field accepts only numbers”.

Negative testing can be done using both manual and automation testing. It is also useful while doing security checks of the system. A malicious user deliberately tries to hack the system and exploit vulnerabilities by passing some scripts or commands in the text fields. A thoroughly negative tested application can help in minimizing the risk for the same.

Some Examples of Negative Testing

This section lists some scenarios of negative test cases-

  • On entering invalid and unexpectable values than the one supported by the input fields e.g. negative test data can include passing special characters, foreign language characters, non-text keys, etc in the text boxes.
  • Uploading invalid files to the file upload fields or as an attachment e.g. we may upload a corrupt file, a file containing some virus, a large file with size in GBs (while the application may support only file size in KBs).
  • Following invalid navigations in the application e.g. in order to test the vulnerability of the application a tester may follow the navigation route that is different from the standard path. This can include directly trying to open an authorized URL without authentication or trying to skip some mandatory steps by directly opening a link.

Conclusion

Negative testing is useful in making the system more robust and accurate. It helps the testing team in covering all the possible scenarios which can affect the functioning of the system negatively. 

Negative testing has its own disadvantages too. Apart from being a time-consuming exercise, it also increases workload as it needs extra thinking when it comes to test case creation. But if the application needs to be completely error-free, negative testing is equally important as positive testing.

От QA genius

Adblock
detector