Smoke Testing — Explained with Examples
Smoke testing is a quick sanity check performed after a deployment to verify that the most critical functions of an application work before deeper testing.
Smoke testing (also called sanity testing or build verification testing) runs a minimal set of tests to confirm the application starts, responds to requests, and performs its primary functions. It’s the first gate in the deployment pipeline.
When to Run Smoke Tests
Smoke tests run after every deployment — before the full test suite starts. If smoke tests fail, the build is rejected immediately, saving time and resources.
Code commit → Build → Deploy → Smoke Tests → Full Tests → Release
↓ fail
Reject buildExample: Smoke Test Suite
const axios = require('axios');
const BASE_URL = process.env.BASE_URL || 'https://staging.example.com';
describe('Smoke Tests', () => {
test('application responds with 200', async () => {
const response = await axios.get(BASE_URL);
expect(response.status).toBe(200);
});
test('login page loads', async () => {
const response = await axios.get(`${BASE_URL}/login`);
expect(response.status).toBe(200);
expect(response.data).toContain('Login');
});
test('API health endpoint returns healthy', async () => {
const response = await axios.get(`${BASE_URL}/api/health`);
expect(response.status).toBe(200);
expect(response.data.status).toBe('healthy');
});
test('database connection is alive', async () => {
const response = await axios.get(`${BASE_URL}/api/health/db`);
expect(response.data.dbConnected).toBe(true);
});
test('static assets are served', async () => {
const response = await axios.get(`${BASE_URL}/app.js`);
expect(response.status).toBe(200);
expect(response.headers['content-type']).toContain('javascript');
});
});Real-World Analogy
Smoke testing comes from hardware engineering. When you first power on a circuit board, you check if any components smoke (indicating a short circuit or wrong connection). If smoke appears, you don’t bother with detailed testing — you fix the fundamental problem first. The smoke test catches catastrophic failures early.
Smoke vs Regression
| Aspect | Smoke Test | Regression Test |
|---|---|---|
| Scope | Critical paths only | Full suite |
| Duration | Minutes | Minutes to hours |
| Frequency | Every deployment | Before release |
| Purpose | Quick sanity check | Thorough verification |
| Pass/Fail | Pass to proceed | Pass to release |
Related Terms
Regression Testing, E2E Testing, Integration Testing, Unit Testing, CI/CD
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro