What is Sanity Testing in Software Testing – Various Test Cases

  • Written By The IoT Academy 

  • Published on July 8th, 2024

In software testing, making sure applications work well is very important. Sanity is a key first step before doing more detailed tests. This article explains what sanity testing is. As well as gives examples of test cases, lists useful tools, and shows how it differs from smoke and regression testing. Sanity checks if key parts of the software work after small changes, making sure core features are still intact. Knowing how sanity fits in, comparing it to other tests, and using the right tools. It helps in keeping software development and testing strong and efficient.

Sanity Testing Definition

It is a quick check to make sure that a function or bug fix works properly after a small code change. It is part of regression testing, focusing on a specific part of the application. To ensure it still works correctly after updates or fixes. The main goal is to verify that recent changes haven’t negatively affected existing features. Unlike more detailed tests, sanity testing is narrow and deep, targeting one or a few areas. It helps quickly confirm the stability of the application, making sure minor changes are reliable without doing extensive testing.

Sanity Check-in Testing

In software testing, a sanity check refers to a quick evaluation to see if a given set of conditions or rules holds. In the context of sanity testing, this involves a brief and straightforward verification to determine if the software meets basic requirements. It helps testers confirm that the software build is stable enough for further, more detailed testing.

Sanity Testing Tools

Tools are essential in software testing to quickly verify whether a particular application or system is functioning correctly after minor changes or bug fixes. Here are some widely used testing tools:

  • Selenium: It is a free tool for automating web application testing. It works on multiple browsers and operating systems. As well as testers can write scripts in languages like Java, Python, and C#.
  • JIRA: A tool for tracking bugs, managing issues, and handling projects. It also helps to organize sanity tests with features like custom workflows, dashboards, and reports.
  • QTP/UFT: It is a user-friendly sanity testing tool for automated functional testing. It supports many types of applications and uses VBScript for writing tests.
  • TestComplete: TestComplete is an automation tool that tests web, mobile, and desktop applications. It includes features like keyword-driven and data-driven testing and easily integrates with CI/CD tools.
  • SoapUI: A free tool for testing web services and APIs. It performs functional, regression, and load testing and supports protocols like SOAP, REST, HTTP, and JMS.
  • Postman: Postman is a widely used tool for API testing. It has an easy-to-use interface for creating and executing API requests and supports automated testing with JavaScript scripting.

These tools help testers quickly check if an application works properly after changes. As well as they also automate repetitive tasks and organize tests. Also, create detailed reports, making the testing process easier and more reliable.

Example of Sanity Testing

Scenario: Fixing the Login Feature

Context: The development team has fixed a bug in the “Forgot Password” feature of an app. Now, they need to check if the main login function still works correctly.

Steps for Sanity Check in Testing:

  1. Check Login with Valid Credentials:
  • Test Case: Enter the correct username and password.
  • Expected Result: The user should be able to log in.
  1. Check Login with Invalid Credentials:
  • Test Case: Enter the wrong username or password.
  • Expected Result: The user should see an error message.
  1. Verify “Forgot Password” Link:
  • Test Case: Click on the “Forgot Password” link.
  • Expected Result: The user should go to the password recovery page.
  1. Check Password Recovery Process:
  • Test Case: Enter a registered email on the password recovery page.
  • Expected Result: The user should get an email with password reset instructions.
  1. Check UI and Usability:
  • Test Case: Ensure all buttons, fields, and links on the login page look right and work.
  • Expected Result: Everything on the login page should look good and work properly.

Purpose: These sanity tests quickly check if the main login functions are still working after fixing the “Forgot Password” bug. This ensures that the changes did not break anything important.

Sanity Test Cases

Choosing the right test cases for sanity testing involves focusing on critical functionalities that are most susceptible to breaking due to recent changes. Factors to consider include:

  • Frequency of Use: Test cases should prioritize functionalities used frequently by end-users.
  • Impact: Focus on features that, if broken, would significantly impact the user experience or core business operations.
  • Risk Assessment: Evaluate the risk associated with each functionality to prioritize testing efforts effectively.

Smoke Testing vs Sanity Testing vs Regression Testing

Before diving deeper into testing, it is essential to understand its relationship with smoke testing and regression testing.

  • Smoke Testing: Smoke testing, similar to sanity testing, is an initial testing phase to confirm whether the most critical functions of a program work but is broader in scope. It’s typically done to determine if the software build is stable enough for further, more detailed testing.
  • Regression Testing: Regression testing, on the other hand, is conducted to ensure that recent code changes haven’t adversely affected existing features. It aims to catch unintended side effects of software modifications.

So, here is a simple comparison table of Smoke Testing vs Sanity Testing vs Regression Testing:

Aspects Smoke Testing Sanity Testing Regression Testing
Purpose To check the basic functionalities of the app To verify specific bug fixes or new features Ensure new changes haven’t broken existing features
When Done Early in the development cycle After a bug fix or a minor change After any changes or updates to the code
Scope Broad and shallow Narrow and deep Wide and deep
Time Quick Quick Time-consuming
Automation Can be automated Can be automated Often automated
Test Coverage High-level tests Detailed tests on specific areas Extensive tests across the application
Test Cases General, predefined Specific, targeted Comprehensive, all-encompassing
Tester Focus Basic functionality Critical functionalities Full system
Failure Impact Indicates major issues Indicates specific bugs still exist It suggests any functionality broken
Examples Basic app launch and login Verify the fixed login issue Re-run all login, profile, and payment tests

Also Read: Explore the Difference Between Severity and Priority in Software Testing

Conclusion

In conclusion, sanity testing is crucial in software testing to ensure recent changes haven’t broken the core functions of an application. It quickly checks important parts of the software to make sure they still work before doing more detailed tests. Unlike smoke and regression testing, this testing targets specific areas to find problems early, saving time and effort. Tools like JUnit, Selenium, and TestNG help make these tests more efficient. Clear and simple test cases are important for good sanity testing, making sure the software is ready for more testing.

Frequently Asked Questions

Q. How do you explain sanity testing in an interview?

Ans. In interviews, sanity testing is described as a quick check. To ensure that the main features of software work well after small changes. As well as it confirms recent updates didn’t cause unexpected problems.

Q. How to choose sanity test case?

Ans. When choosing sanity test cases, focus on critical functions that could easily break after updates. Prioritize them based on how they affect the software’s overall performance and user experience.

About The Author:

The IoT Academy as a reputed ed-tech training institute is imparting online / Offline training in emerging technologies such as Data Science, Machine Learning, IoT, Deep Learning, and more. We believe in making revolutionary attempt in changing the course of making online education accessible and dynamic.

logo

Digital Marketing Course

₹ 29,499/-Included 18% GST

Buy Course
  • Overview of Digital Marketing
  • SEO Basic Concepts
  • SMM and PPC Basics
  • Content and Email Marketing
  • Website Design
  • Free Certification

₹ 41,299/-Included 18% GST

Buy Course
  • Fundamentals of Digital Marketing
  • Core SEO, SMM, and SMO
  • Google Ads and Meta Ads
  • ORM & Content Marketing
  • 3 Month Internship
  • Free Certification
Trusted By
client icon trust pilot
1whatsapp