Smoke and Sanity are two most confusing statements, hard to understand for beginners in the field of Software Testing.
Smoke Testing is done to make sure that all critical functionalities end to end are functioning properly so that QA Team can further proceed with more vigorous tests developed in Test Suite. Smoke is basic check at initial builds of a product where QA Team needs to be decisive: Whether to accept the build for QA or reject it? As there is no point driving a wheel-less vehicle, there is no point testing any code with missing critical functionalities. For Example: If Homepage of a website is not opening at all, build should be rejected and sent back to Development team instead of wasting time and accepting such builds.
Sanity Testing is done to make sure that all major new functionalities and bug-fixes are working fine. Sanity is done mostly at later builds / enhancements when the product is almost stable. For example: If the design of a website is to be changed and QA finds out that previous design is still coming, there can be some code merge issues or the services might not have been restarted or it might be cached somewhere, the Sanity test failure will stop QA Team to proceed further as the functionality that was to be tested is not at all testable.
Smoke Testing is usually scripted, automated or documented in most of the organisations, where as Sanity isn't (for an incomplete product).
Once a Web application is live running on production server, Sanity tests can be automated to check health of website daily at regular intervals. For an e-commerce website, sanity test cases may include:
- Sign In & Sign Out
- Homepage Components
- My Account
- Product Search
- Product filters
- Category Mapping
- Checkout (Both Guest & Logged In)
- Thank you page
But, for websites having frequent changes on basic functionalities, Automating Sanity is not suggested as the cost of maintaining the test suite would be quite expensive.