Sunday, April 18, 2021

Negative Testing in Software Testing

Ensuring application endurance through negative testing:

We often see that project teams focus on the happy path testing checking all the valid conditions and valid data input.  Positive testing determines that your application works as expected and it doesn’t consider the scenarios to handle unexpected data. Due to project timelines and similar constraints, teams skip the negative test scenarios.

What is negative testing?

  • Type of testing that checks an application for unexpected data and input conditions

  • It is also referred as error path testing or failure testing 

  • It checks on unexpected data what will be the behavior of the application

Why negative testing?

  • To prevent application from crashing due to invalid inputs 

  • To improve the quality of the application

  • To ensure that application can gracefully handle the unexpected or invalid data input by user.

  • To validate an application against invalid data 

  • It helps to ensure defect free application

  • If negative testing is skipped, it might lead to product/service quality issues 

Examples of negative testing

  • If a user enters letter in a numeric field like Mobile number then the correct behavior in this case would be to display a message as ”Incorrect data type, Please enter a number”

  • Real time example: If a lift is designed in such a way that its capacity is of 8 persons weighing total of 400 kgs, what will be the behavior if the person and weight limit exceeds. Ideally it should give a warning signal  (This example refers to boundary value analysis technique)

How to write negative test cases:

  • Consider designing a negative test case by selecting invalid input data or unexpected user behavior. Eg: If a email field is required and it should be in correct email format, then below 2 negative test scenarios will be considered.

  • To skip the required email field and proceed with submitting the form

  • To enter wrong email format and try to submit the form

Designing proper and precise negative test scenarios requires skill, foresight as a tester. All these skills come with experience.

Negative testing plays a very important role in high performance software development. It is a quality control practice that ensures complete test coverage in an application

Project teams should consider critical negative test scenarios for the smooth functioning of the applications and showcasing the application in which it gracefully handles all the invalid set of input data given to the system.

While testing an application thoroughly negative and positive testing both are equally important.

So why not focus on making our application defect free. Let us start..


No comments:

Post a Comment