What is sanity testing?

Software testing

In software development, we need to be able to ascertain that our software works as intended. To verify our claims about our software, we need to put it through some form of testing before we ship it out. Software testing involves using manual or automated tools to evaluate one or more properties of interest, with the intent to find failures and verify that the software product is fit for use.

Software testing is important because it helps us identify and fix bugs or errors in the software before the delivery of the software product.

Software testing can be very laborious and expensive in some cases, especially when we have to test the whole software after development or bug fixes. Sometimes, to make the testing process easier, a form of software testing that offers quick, broad, and shallow testing is required. This quick test should evaluate specific functionality, such as whether or not a particular bug fix works as expected without testing the wider functionality of the software. This type of testing technique is known as sanity testing.

Sanity testing

A sanity test is a software testing technique that is used to determine whether it is reasonable and possible to proceed with further testing. This type of testing is used to determine if the software just needs further debugging by the developer or if it should be passed on to quality assurance (QA) for rigorous testing. If the sanity test fails, the product is rejected and sent back to the developer to save the resources involved in more rigorous testing.

An example of common sanity testing is passing different parameters into a function to check for the correctness of the output.

Sanity testing is sometimes confused with smoke testing. Smoke testing is a minimal test that determines whether there are any basic problems that will prevent the software from working at all.

A sanity testing chart

Characteristics of sanity testing

  • Sanity testing is carried out to test the new functionality that has been added or that bugs have been fixed.
  • Sanity testing is targeted at reducing the cost and time spent in running unnecessary tests.
  • Sanity testing targets a particular component of the entire software.
  • Sanity testing is usually carried out by testers as an acceptance test and is often undocumented.
  • Sanity testing can also be carried out by developers mid-development.
  • Most importantly, sanity testing is carried out to determine how rational it would be to proceed with rigorous testing of the entire software.

Sanity testing goes a long way in software testing, and some important sanity tests are carried out on the installation of production software code into a new computing environment to ascertain that all dependencies are met. An overlooked example of sanity testing is running a simple “Hello, World” program in your development environment to confirm that the code you will be writing will be processed and compiled properly.

Free Resources