What is Sanity Testing and How to Do It Right? (2024)

Quality AssuranceApril 6, 2023

  • Margarita DžeriņaQA Engineer

What is sanity testing and why is it necessary?

Sanity testing is a type of software testing that is used to verify that a small change or a bug fix in the software is working as intended and has not caused any unexpected side effects or broken any existing functionality. Interestingly, according to a HackerRank report, the most common bugs found in production were a result of deploying untested or broken code. As a result, sanity testing is crucial to ensure all aspects of the software are checked accordingly.

The main goal of sanity testing is to validate the changes made to one or few specific parts of the application and not detailed testing. It is a quick and superficial check to ensure that the system is still functioning as expected after a change has been made. Additionally, sanity testing is often used as a preliminary step before conducting more extensive testing, such as regression testing. It is an important part of the software development process because it helps to ensure that changes to the system do not negatively impact its overall stability and functionality. Usually sanity tests are derived from existing regression tests, but, unlike regression testing, sanity testing typically is unscripted.

Sometimes the term 'sanity testing' may be used interchangeably with 'smoke testing'. They are both similar in that they determine whether it is possible and reasonable to continue testing further, however, there are a couple of key differences between the two.

Difference between sanity testing and smoke testing

What is Sanity Testing and How to Do It Right? (1)

As the name implies and as we explained above, sanity testing aims at checking the obvious—whether the intended result of a code change works correctly. Smoke testing, on the other hand, checks if nothing else important was broken in the process.

Some believe that the term 'smoke testing' originated in electronic hardware testing. In his book “Lessons Learned in Software Testing”, Bret Pettichord provides the origin of the term:

"The phrase smoke test comes from electronic hardware testing. You plug in a new board and turn on the power. If you see smoke coming from the board, turn off the power. You don't have to do any more testing."

Thankfully, in software testing there isn’t any actual smoke in the event of failure.

Smoke testing is a type of testing that is used to determine if the software is stable enough to proceed with further testing. It is usually done early in the testing process and is designed to ensure that the most important functionality of the software is working correctly. For people new to software testing it can be difficult to differentiate between smoke and sanity testing, as they are similar. Both are used to verify the basic functionality of an application, but there are three main differences:

  • Scope
    Sanity testing is typically more focused in scope than smoke testing. Sanity testing checks specific functionality, for example, if a particular bug fix is working as expected. Smoke testing, in contrast, has a broader and more thorough test scope that checks the most crucial functionality of the application.
  • Depth
    Sanity testing is a superficial check for one or few specific parts of the application. It is a quick and lightweight testing process that is not designed to uncover deep-seated issues or errors in the system. In comparison, smoke testing is a more thorough test that can uncover major issues or defects in the system, as it tests the critical functionalities independent of the new feature, change or fix.
  • Purpose
    The primary purpose of sanity testing is to confirm that a small change to the system has not caused any unintended side effects or broken any existing functionality. Smoke testing, on the other hand, is used to verify the overall functionality of the system and ensure that it is stable and ready for further testing.

To sum up, the main difference between sanity and smoke testing is that sanity testing checks one or few specific parts of the application, while smoke testing checks the critical functionalities independent of the new feature, change or fix. Now that the main characteristics of sanity and smoke testing are clear, there is another question—which should be done first, sanity or smoke testing?

When should sanity testing be done?

Let’s look at the software development process for a mobile application as an example. After a new mobile app build is released, it usually requires smoke testing. If smoke testing is successful, then sanity testing is conducted. And if this is also successful, then more extensive testing—functional and/or regression testing—is done. Sanity testing is usually performed after smoke testing because smoke testing ensures that the build is stable. See the flowchart below.

What is Sanity Testing and How to Do It Right? (2)

If smoke testing fails, it usually indicates that there are serious problems with the software. Further testing should not be done until the issues are resolved. If sanity testing fails, it usually indicates that there is a problem with a specific feature or functionality of the software. In both cases the development team should be notified and the issues that caused the failure should be addressed. If smoke tests passed but sanity tests failed after which a new version of the mobile app is released, it would be a good idea to perform smoke testing before repeating the sanity testing.

Performing smoke testing before repeating sanity testing helps ensure that the new version of the mobile app is stable and that it is safe to proceed with further testing. This helps to prevent further problems from occurring and helps to ensure that the software is of high quality. Once smoke testing has been completed successfully, sanity testing can be repeated to verify that the specific feature or functionality that failed previously is now working as expected.

These repeated testing efforts may seem like a lot, but without sanity testing, if a full testing cycle is started, then testing efforts most likely would go into vain if a new release is required. The pros of sanity testing outweigh the cons.

Pros and cons of sanity testing

Pros of sanity testing:

  • Quick. Sanity testing helps to avoid wasting time and effort by quickly determining whether an application is too flawed to merit more rigorous testing.
  • Efficient. Sanity testing is an efficient way to verify that a small change or modification to the system has not caused any unintended side effects or broken any existing functionality.
  • Focused scope. Because it is a more focused test, sanity testing allows testers to focus on one or few specific areas of the system and confirm that the changes there have not caused any unintended side effects.
  • Cost-effective. Sanity testing is typically a fast and lightweight testing process that does not require a lot of resources or time to complete. As a result, it can be a cost-effective way to ensure that the system is still functioning as expected after a change has been made.

Cons of sanity testing

  • Limited scope. The limited scope of sanity testing means that it may not uncover deep-seated issues or defects in the system.
  • May not detect all issues. Because it is a superficial check, sanity testing may not detect all issues or errors that may be present in the system.
  • May not be sufficient. In some cases, the changes made to the system may be more significant than a simple bug fix or code change, in which case a more thorough testing process, such as regression testing, may be needed to ensure the stability and functionality of the system.

Now that we know what sanity testing is, why and when it should be done as well as the advantages and disadvantages of it, only one question remains.

How to do sanity testing right?

What is Sanity Testing and How to Do It Right? (3)

Here are three best practices for conducting effective sanity testing:

  1. Define the scope. Clearly define the scope of the sanity testing process, establish what exactly needs to be tested. This should include the specific areas of the system that will be tested, as well as any specific requirements or constraints that need to be considered. Sanity testing usually is unscripted, which means that there are no test steps to follow, however, defining the scope (for example, as a checklist of things that need to be tested) would definitely be useful so that nothing important is missed.
  2. Use automated tools. If possible, it is a good idea to automate tests that are run often. Consider using automation testing tools to help streamline the sanity testing process and reduce the time and effort required to complete it. Automating tests speeds up checking and comparing the expected result with the actual one and allows tests to run in parallel. It would also decrease the reliance on regression testing since sanity tests are based on regression tests and if the sanity tests are automated that means that troubleshooting can be continuous.
  3. Review the results. The results of the sanity testing will help to identify any areas where additional testing may be needed. This may include running additional test cases or conducting more thorough testing, such as regression testing.

These best practices may as well be used for other types of testing, like smoke or regression testing, because they are more or less universal. However, sanity testing is relatively easy to do compared to other types of testing that, of course, have their own benefits and purpose but require much more effort. By following these best practices, the sanity testing process will be effective and help to confirm the stability and functionality of the application after small changes or modifications have been made.

Key takeaways

Sanity testing is used to validate the changes made to one or few specific parts of the application in order to make sure that the software is still functioning as expected after a small change or a bug fix. It is often used as a preliminary step before conducting more extensive testing, such as regression testing. In comparison to sanity testing, smoke testing is a broader and more thorough test that checks the most crucial functionality of the application but sanity testing checks only specific functionality after some changes have been made to it.

To ensure the best results from sanity testing, make sure to: clearly define the testing scope, use automated tools if possible and review the results in order to identify areas where additional testing should be done.

Do you have an application or software solution that could use some testing? Check out our different software testing services and contact us for more information on how we can help you.

What is Sanity Testing and How to Do It Right? (2024)

FAQs

What is sanity testing and how to do it? ›

Sanity testing is used to validate the changes made to one or few specific parts of the application in order to make sure that the software is still functioning as expected after a small change or a bug fix. It is often used as a preliminary step before conducting more extensive testing, such as regression testing.

How do you explain sanity testing in an interview? ›

Sanity testing is performed to ensure that the code changes that are made are working properly. Sanity testing is a stoppage to check whether testing for the build can proceed or not. The focus of the team during the sanity testing process is to validate the functionality of the application and not detailed testing.

What is sanity and how do you use it? ›

Sanity uses structured content to endlessly re-use content across any channel and a composable approach to help businesses connect to any third-party technology, data source, and front end framework. With Sanity you can manage your text, images, and other media with APIs.

What is a real life example of sanity testing? ›

Let's understand sanity testing through an example. Suppose you develop an online food ordering application, and you want to offer a 15% discount on Christmas (25th December) for your members having a premium membership. The sanity testing will verify the following: Premium members get the discount on the 25th.

How to write sanity test case with example? ›

Here, we do a sanity test of the application. Non-technical example: Suppose you are developing a mobile application and encounter a payment checkout error. The testing team reported this error to the developing team to resolve it quickly. The development team fixed the error and sent it to the testing team for a fix.

What is sanity check in QA? ›

Sanity testing, also known as sanity check testing, is a type of software testing that focuses on quickly verifying specific functionalities or areas of the application after a bug fix, feature addition, or minor changes.

What is an example of a sanity check? ›

In arithmetic, for example, when multiplying by 9, using the divisibility rule for 9 to verify that the sum of digits of the result is divisible by 9 is a sanity test—it will not catch every multiplication error, but is a quick and simple method to discover many possible errors.

What is sanity checklist? ›

A sanity checklist is usually run on stable but not necessarily functional software. For example, after making small changes to a software build, software testers can run sanity tests to ensure those changes work correctly before proceeding to full regression testing.

What is sanity testing in agile methodology? ›

Sanity testing helps in identifying defects related to recent changes or updates, ensuring that the new code integrates well with the existing system without causing disruptions. This is particularly important in Agile and iterative development models where changes are frequent and incremental.

What is an example of sanity? ›

Examples of sanity in a Sentence

She is the mother of six children but somehow keeps her sanity. The sanity of the decision was never in question.

How do you handle sanity? ›

7 Sure-Fire Ways to Reduce Stress and Restore Your Sanity
  1. Exercise. I've been using a trainer for a while, but before that my primary exercise was running. ...
  2. Sleep. Getting solid, regular sleep has become one of the main things I do stay balanced. ...
  3. Connection. ...
  4. Learning. ...
  5. Art. ...
  6. Movies. ...
  7. Gratitude.

Is sanity testing functional or nonfunctional? ›

Several testing types are considered functional testing like smoke testing, sanity testing, regression testing, and more.

Why is it called sanity testing? ›

It is performed on the stable build of the software. To understand the concept of sanity testing, we can analyze its name: sanity. The term came from the concept of “sanity check”. The goal is also to verify that the build is stable enough for further testing, similar to smoke testing.

What is the responsibility of sanity testing? ›

Sanity testing, often considered a subset of regression testing, plays a pivotal role in the early stages of SDLC. Its goal is to assess whether the core functionalities of an application are working as expected. Unlike scripted tests, Sanity Testing is usually unscripted, focusing on limited functionalities at a time.

What is the difference between sanity and smoke testing? ›

Smoke test is done to make sure that the critical functionalities of the program are working fine, whereas sanity testing is done to check that newly added functionalities, bugs, etc., have been fixed. The software build may be either stable or unstable during smoke testing.

What is sanity how it is measured? ›

In summary, the 'test for sanity' involves the comparison of one's mental state to that of a presumably sane person. Specifically, it involves convincing that person that you can see that your own view of the world is distorted in some way.

Top Articles
8 Must Have Trading Tools
Our Best-Ever Tips for Saving Money
Online Reading Resources for Students & Teachers | Raz-Kids
La connexion à Mon Compte
St Als Elm Clinic
Miss Carramello
Bustle Daily Horoscope
How To Delete Bravodate Account
4Chan Louisville
Ssefth1203
‘Accused: Guilty Or Innocent?’: A&E Delivering Up-Close Look At Lives Of Those Accused Of Brutal Crimes
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
What is Rumba and How to Dance the Rumba Basic — Duet Dance Studio Chicago | Ballroom Dance in Chicago
Spectrum Field Tech Salary
Milspec Mojo Bio
Ms Rabbit 305
SF bay area cars & trucks "chevrolet 50" - craigslist
Drago Funeral Home & Cremation Services Obituaries
Eine Band wie ein Baum
Https Paperlesspay Talx Com Boydgaming
Titanic Soap2Day
Glover Park Community Garden
Form F-1 - Registration statement for certain foreign private issuers
Teekay Vop
Loslaten met de Sedona methode
Mta Bus Forums
Dashboard Unt
Usa Massage Reviews
Possum Exam Fallout 76
Christmas Days Away
Kelley Fliehler Wikipedia
Ghid depunere declarație unică
Productos para el Cuidado del Cabello Después de un Alisado: Tips y Consejos
Wbli Playlist
Honda Ruckus Fuse Box Diagram
Mta Bus Forums
Otter Bustr
Sam's Club Gas Prices Florence Sc
Jasgotgass2
Pulitzer And Tony Winning Play About A Mathematical Genius Crossword
Smite Builds Season 9
Cuckold Gonewildaudio
Wordle Feb 27 Mashable
Martha's Vineyard – Travel guide at Wikivoyage
Tommy Bahama Restaurant Bar & Store The Woodlands Menu
Sara Carter Fox News Photos
Star Sessions Snapcamz
Craigslist Monterrey Ca
Cool Math Games Bucketball
Bellin Employee Portal
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 6582

Rating: 4.3 / 5 (54 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.