Sanity Testing

Sanity testing is a software testing, which is carried out relatively with the smoke test and the regression test to check whether the functionality or the validity of the functions are still holding the same way before any regression was carried out.

sanity-testing-demo

As we have stated earlier, that it cannot be directly assumed or predicted that at which phase the sanity testing is to be carried out, but it is clear that it is done just after the regression testing, as in regression the new functionalities and features are added.

Sometimes, the process of regression and sanity testing is iterated one after another, and so it becomes difficult to figure out which has been done first.

And the concept of smoke testing fully relates with the sanity as well as the regression testing. This may be seen or considered as a very narrow approach, but the depth is really more. It does not discuss many things, but the few things, mainly the quality is sincerely maintained.

Below diagram shows the scope of Sanity Testing :

regression-smoke-sanity

Interface Testing

Goals of Sanity Testing

  • To check whether all the functionalities are the same after the regression test is carried out in iteration.
  • To check that all the functionalities and user requirements are meeting, this is an end-user perspective.
  • To check that the quality, efficiency, and performance and validity of the function have not been changed.
  • To check that the requirements mentioned in the specification documents are, all fulfilled.
  • To check whether the changes made in the coding, even in the smaller scope, has not changed the functionality. There may be some time, a function which is interrelated with other functions, which has to be maintained anyways.

Concluding, that the main aim of the sanity testing is to assure that the functionality of the software is maintained, even after single or many iterations of regression are carried out.

Interface Testing

Issues or defects which sanity testing can solve

  • There can be defects like, missing dependencies between the functions after regression, which is tested in Sanity testing.
  • The function may lose its, security and coupling with other function, but may still give valid results, which is checked in the sanity testing while assuring the efficiency.
  • There can be a leakage in the modules or function after new features are added during regression, this is also tested here. A leakage in the function may lead to the entire software to crash or come under vulnerable attack.
  • Most of the time, the sanity test is unscripted, and so the defect of dependent missing functionalities can be figured out. This way defect can also be checked.
  • The function may perform well, but its scope of working may have changed, in that case also, sanity test helps us to figure out the defect.
  • Sanity testing can detect whether
  • There can be induced statement or coding inside or outside functions, which may be very risky and may cause damage to the software. This is also detected in sanity testing.
  • There can be a function which should be invoked only when all the alternative has been failed. For example, the user may get chance of entering a password and the username for first, second and the third time. But after that, the account should be blocked. This function-redirection is also detected here.
  • There can be a functional dependency like one function is fully dependent on each one. And maybe connected through a pipeline, in that case, the second function which is data dependent on the first function, should not produce any result, if in case the first function has not produced any data at all.

Example of sanity testing

Suppose, we have different modules like login, add-to-cart, buy, etc in a software. Now in the first module, that is, the log-in mode there are credentials like the username and the password. In the sanity testing, the concern would be whether the module login, is creating a valid user-session for the user.

This session should be created for the user only on fulfilling the criteria for the credentials, that is the username should be valid with at least 2 alphanumerics and the password must a valid.

Now, when the user session is created successfully, then the next main function which is dependent on it is the logout function. So, sanity testing will not go wider in checking with the other modules instead, it would check the functionality of the log out.

Now in case, if the password is invalid, and still the user is able to log inside the user's session then, the software is at heavy risk and this bug must be reported to the development team as soon as possible.

Retesting

Advantages of Sanity Testing

  • Sanity testing is the simplest way to assure the quality of the product before it is developed.
  • Sanity testing helps us to detect errors in the earlier stages of software development.
  • Sanity testing is less cost expensive compared to all other tests.
  • Sanity testing cases are designed as a lightweight test case, which can be applied in iteration with a regression test.
  • Sanity testing is simple to understand and to carry out, yet very effective in detecting bugs.
  • Sanity testing can reduce the effort during the smoke and regression testing.
  • Sanity testing focuses only in certain areas of tests, and thus reduce the time and effort of testing.
  • Sanity testing is the only testing which assures that a negligible change in the coding has affected the performance of the functions in the software or not.
  • Sanity testing reduces the workload in the in later developmental phases of the software testing or development.

Backend Testing

Disadvantages of Sanity Testing

  • Its scope is relatively narrow, compared to the other types of testing.
  • Sanity testing sometimes overlooks the efficiency of the codes by solely focussing on the validity of the functions.
  • Sanity testing, only ensures that adding new features in the software or modification in the codes has to affect the software functionalities, but it will not consider in the changes in some functionalities which may be required.
  • Most of the time Sanity testing is not at all scripted, which may be a problem for some testers.

Frontend Testing

Relation of sanity, smoke and regression testing

In the software testing industry, many get confused about these three different kinds of testing. One is regression testing, smoke testing, and sanity. It should be made clear, these three are totally different testing, and should not be misunderstood.

Since they are solely interrelated topics, therefore their ideas may get overlapped sometimes. Here are some clarifications about the three different kinds of tests.

  • Sanity test is done just after the regression test, to ensure that, the changes made just before the regression to ensure the stability of the system, are holding good. That is, no functionality has been changed due to the addition or updation of the software. Smoke testing is done just after that.
  • Sometimes, smoke test and sanity test may run parallely. Meaning, there can be software builds which can be different. Some builds may require to go through smoke testing and some may require to go through sanity testing, which has undergone regression testing a lot of times.
  • Smoke test may be sometime iterated with regression testing, as with changes different features may be modified which may require sanity test in recursion.

Below diagram shows how these three testings are inter-linked.

regression-smoke-sanity

Therefore, to conclude, about the relation of smoke, sanity and regression tesitng, this can be said that, all are inter-related and one should not get confused with their scope of work.

One test can be carried out earlier and another may be carried out later, based on the scenario, but that does not mean, that they are fully overlapped or not related at all.

Protocol Testing

Smoke testing Vs Sanity testing

  • Smoke test is carried out as overall testing, where sanity testing is carried out for a particular functionality at a time.
  • Smoke test can be carried out once the complete sofware is developed, on the other hand, the sanity testing can be done at any time in the development or the testing phase, as it is mainly, concerned with the software builds and functionality.
  • Smoke test is scripted, but sanity test is non-scripted, as the test aim is not clear at the time of initiation of the test.
  • Smoke testing is mainly done earlier of regression test or any other test, on the other hand, the sanity test is done after the smoke test is carried out. Mainly, it is done after the regression testing is done. Sanity is all about the last testing before the quality assurance.
  • Smoke testing is initiated with the objective that, that any application or code blocks which are corrupt or producing non-relevant results, should be discarded. On the other hand, in sanity test, the main and sole purpose is to ensure that the functionalities are meeting the demand as per the SRS.
  • Smoke testing is a wider approach which does not deal with the depths of the functionality of the function. On the other hand, sanity testing is a narrow approach and deals with the depth of the functionalities.

Maintenance Testing

Important points about Sanity Testing

  • Sanity testing deals with minor fix issues only.
  • Sanity testing is unscripted.
  • Sanity testing is done anytime when the team needs the current state of the software quickly.
  • Sanity testing is preferable after the smoke test is carried out successfully, and the modules have already cleared a quality assurance form the QA Team.
  • Sanity testing is the only tool for the developers for getting a quick state of the software at any phase.
  • Sanity testing will be performed in one or two or three functionalities of the software which is a good process not creating a mess.
  • Sanity testing can be done by developers only, and not by persons who have limited knowledge of troubleshooting.
  • Sanity testing can be a good choice for detecting conflicting functions.
  • Sanity testing some time is considered as a subset of regression of testing and can be used as mini-regression testing when there is really no time for carrying out the regression testing in details.
  • Sanity testing, will only work on software builds and this test cannot be carried out on the raw code.
  • Sanity testing is the easiest way to check the interdependency of the functions, that is whether the inter-relational function binding is holding good enough after the regression has been iterated on the software.
  • Sanity testing will not cover major software flaws, on the other hand, it is the work of the regression test to check the functionalities.

Penetration Testing

Summary

In sanity testing, we are concerned about the testing the software, whether after regression and addition or modification of new functionalities also, all the features are safe and nothing has been hampered.

This testing is different from regression testing, in only one sense, that, in regression testing, we are concerned about the functionalities only, but in the sanity testing, all the functional and non-functional requirements and properties of the software is checked again to their validity.

Sanity testing can be seen as a refined version of regression testing.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions