📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

What are smoke, regression and functional tests? Explain what each one checks, how they relate to unit and integration tests, and where each fits in a release pipeline for a .NET service.

Smoke, regression and functional tests: what each checks, how they overlap with unit, integration and E2E tests, and where they run in a CI/CD release pipeline.

Junior Theory Beginner ci-cd functional-testing regression-testing release-pipeline smoke-testing testing

🎯 Key points

  • Smoke test: a few fast checks that a deployed build is alive and wired (health endpoint, version, one authenticated call)
  • Smoke tests run right after every deployment and gate slot swaps or canary promotion
  • Regression test: any test that guards behaviour that worked before; the automated suite is the regression suite
  • Every bug fix gets a regression test that fails before the fix
  • Functional test: checks a feature against its requirement, black-box (WebApplicationFactory at API level, Playwright for .NET at UI level)
  • These are purposes, not levels: a regression test can be a unit or an E2E test
  • Tests are isolated and order-independent; flaky tests are fixed or quarantined so the suite stays trusted
  • Pipeline order: unit and integration on PR (feedback in minutes), smoke after deploy, functional/E2E as a release gate

⏱ 30-second answer

These names describe a test's purpose, not its size. A smoke test is a handful of fast checks that a freshly deployed build is alive: /health returns healthy, a user can sign in, one key API call works. It runs straight after every deployment and decides whether traffic moves to the new version. A regression test guards behaviour that already worked; in practice your whole automated suite is the regression suite, and every bug fix adds a test that fails without the fix. A functional test checks a feature against its requirement from the outside, black-box. The trade-off: smoke tests are shallow but fast enough to gate every deploy; full functional and regression runs are thorough but too slow to run everywhere.

🗣 Full answer (senior)

How I would answer this in an interview

"I think of these as purposes rather than levels. A smoke test asks 'is this build alive and wired up?'. It's a small, fast set of checks run right after deployment: the health endpoint reports healthy including the database, a user can authenticate, and one or two key endpoints return the right shape. If it fails, we don't swap the App Service slot or we roll back. It should take under a minute.

A regression test is any test that protects behaviour that used to work. The whole automated suite, unit and integration, is the regression suite, and it runs on every pull request. The discipline that matters is: when we fix a bug, we first write a test that reproduces it and fails, then fix the code. That test stays forever. A functional test checks a feature against its requirement from the user's side, black-box: 'a member ordering $150 is charged $135'. It can be an API test with WebApplicationFactory or a Playwright test against a deployed environment.

The mistake I see is treating these as separate suites that someone runs manually before a release. A manual 'regression phase' of two weeks is a sign the automated tests don't cover enough. I'd want the regression suite automated and gating every merge, smoke tests automated after every deploy, and functional tests on the critical journeys running as a release gate."


Purpose, not level

Name Question it answers Usual level When it runs
Smoke Is the deployed build alive? E2E-lite, HTTP checks After every deployment, before or right after traffic
Regression Did we break something that worked? Any (mostly unit and integration) Every PR and merge
Functional Does the feature meet the requirement? Integration or E2E, black-box PR (API-level) and release gate (UI-level)
Sanity Does this one change basically work? Narrow manual or automated check After a hotfix

Where they fit in a pipeline

 PR opened
   -> build, unit tests, integration tests   (regression + functional at API level)
 merge to main
   -> build once, publish image
   -> deploy to staging slot
   -> smoke tests against staging slot
   -> functional/E2E tests (Playwright)      (release gate)
   -> swap slot to production
   -> smoke tests against production
   -> auto rollback (swap back) if smoke fails

What a good smoke test checks

  • /health/ready returns 200 and reports SQL Server, Redis and Service Bus as healthy.
  • The app version endpoint reports the commit SHA you just deployed (proves the right build is live).
  • One authenticated call succeeds with a test identity.
  • It does not create real orders or send emails; it is read-only or uses clearly marked test data.

Production example

A team swapped App Service slots with no checks. A missing Key Vault access policy made every request fail for 12 minutes after a swap. Adding a 30-second smoke step against the staging slot (health endpoint with a Key Vault check plus one authenticated GET) stopped the next two broken swaps before any customer saw them.

🔍 What the interviewer is checking

Checks whether the candidate understands test purposes and how they map onto a real pipeline.

Green flags

  • Explains these are purposes, not levels.
  • Puts smoke tests right after deployment as a gate.
  • Adds a failing test before every bug fix.
  • Mentions checking the deployed version.

Red flags

  • Describes a long manual regression phase as normal.
  • Thinks smoke tests are just "quick unit tests".
  • Has no idea where tests run in the pipeline.

📚 Learn in depth

1. Why the names overlap

Test names come from two axes:

            scope (how much is real)
            unit ---- integration ---- end-to-end
 purpose
   regression   x          x                x
   functional              x                x
   smoke                                    x

So "a regression test" might be a unit test, and "a functional test" might be an API integration test. Interviewers want you to know both axes.

2. Smoke tests in depth

The name comes from hardware: switch it on and see if it smokes. A smoke test should be:

  • Fast: under a minute, so it can gate every deploy.
  • Shallow but wide: touch each critical dependency once.
  • Safe: read-only or uses test tenants, so it can run in production.
  • Version-aware: confirm the expected build is running, not the old one.

In ASP.NET Core, health checks (AddHealthChecks().AddSqlServer(...)) make the server side easy; the smoke test is often a few HTTP calls in a pipeline step or a tiny xUnit project pointed at a base URL.

3. Regression tests in depth

A regression is a bug in behaviour that used to work. Automated regression protection comes from:

  1. Every bug fix starts with a failing test.
  2. The suite runs on every PR, so regressions are caught before merge.
  3. Flaky tests are fixed or quarantined fast; a suite people ignore protects nothing.

4. Functional tests in depth

Functional tests are black-box: they know inputs and expected outputs, not internals. In .NET they are often written against the HTTP API with WebApplicationFactory, or against the UI with Playwright for .NET. Writing them from acceptance criteria (Given/When/Then) keeps them tied to requirements.

5. Manual testing still has a place

Exploratory testing by a human finds things scripts don't think of. It should look for new problems, not re-run the same checklist every release.

Try it yourself

  1. Add AddHealthChecks() with a SQL Server check to an API and hit /health.
  2. Write a smoke test project that takes a base URL from an environment variable and checks /health and /version.
  3. Pick a recent bug, write a test that fails on the old code, then confirm it passes on the fix.
  4. Sketch your current pipeline and mark where each test type runs.

💻 Code

A small smoke test project, run after deployment with the target URL in an environment variable:

namespace Shop.SmokeTests;

using System.Net;
using System.Net.Http.Json;
using Xunit;

public sealed class SmokeTests : IDisposable
{
    // The pipeline sets SMOKE_BASE_URL to the staging slot or production URL.
    private readonly HttpClient _client = new()
    {
        BaseAddress = new Uri(Environment.GetEnvironmentVariable("SMOKE_BASE_URL")
            ?? throw new InvalidOperationException("SMOKE_BASE_URL not set")),
        Timeout = TimeSpan.FromSeconds(10)
    };

    private sealed record VersionInfo(string Commit);

    [Fact]
    public async Task Ready_endpoint_reports_healthy()
    {
        var response = await _client.GetAsync("/health/ready", TestContext.Current.CancellationToken);
        Assert.Equal(HttpStatusCode.OK, response.StatusCode);
    }

    [Fact]
    public async Task Deployed_build_is_the_expected_commit()
    {
        var expected = Environment.GetEnvironmentVariable("EXPECTED_COMMIT");
        Assert.False(string.IsNullOrEmpty(expected));

        var info = await _client.GetFromJsonAsync<VersionInfo>("/version", TestContext.Current.CancellationToken);
        Assert.Equal(expected, info!.Commit);
    }

    public void Dispose() => _client.Dispose();
}
# GitHub Actions step after deploying to the staging slot
- name: Smoke test staging slot
  run: dotnet test tests/Shop.SmokeTests -c Release
  env:
    SMOKE_BASE_URL: https://shop-api-staging.azurewebsites.net
    EXPECTED_COMMIT: ${{ github.sha }}

⚠ Common mistakes

  • Mistake: Making the smoke suite a full regression run. Why it is wrong: it becomes too slow to gate every deploy and people start skipping it. Instead: keep smoke tests to a minute of shallow, wide checks.
  • Mistake: Smoke tests that create real orders or send emails in production. Why it is wrong: real side effects, real customers and polluted data. Instead: read-only checks or a clearly marked test tenant.
  • Mistake: Fixing a bug without adding a test that reproduces it. Why it is wrong: the same bug can quietly come back. Instead: write the failing test first, then fix.
  • Mistake: Relying on a manual regression phase before each release. Why it is wrong: slow, inconsistent and it delays feedback by weeks. Instead: automate the regression suite and run it on every PR.
  • Mistake: A health endpoint that always returns 200. Why it is wrong: the smoke test passes while the database is unreachable. Instead: include real dependency checks in the readiness endpoint.
  • Mistake: Not checking which version is live. Why it is wrong: a failed deploy leaves the old build running and smoke tests pass against it. Instead: expose a /version endpoint and assert the commit.

🏛 Senior insight: trade-offs

These terms describe why a test exists, so don't build separate teams or suites around them. What matters is where each check runs and what it gates. Smoke tests earn their keep as the automated gate on slot swaps and canary promotion; the regression suite earns its keep by being trusted enough that a red build stops a merge.

That trust has to be maintained. Each test must be isolated (its own data, no reliance on order or shared state), and the suite's health should be measured like a product: PR feedback time (aim for under 10 minutes), flaky-test rate from CI retry reports, and how many defects escape to staging or production. A flaky test that is retried silently or ignored teaches the team to ignore red builds, which is the end of regression protection. Quarantine it within a day, fix it within the sprint.

Check When it fits Cost When not to
Smoke after deploy Every environment, every deploy Seconds As a substitute for real tests
Automated regression on PR Always Minutes of CI Never skip; fix flaky tests instead
UI functional tests (Playwright for .NET) Critical journeys High maintenance Edge cases better covered at API level

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions running smoke tests after a deployment or slot swap. Why: Checks whether the candidate connects smoke tests to slot swaps, canaries and rollback.
    How to answer

    Rolling replaces instances in batches: no extra capacity, but old and new versions serve traffic together and rolling back means another rollout. Blue-green runs a full second environment and switches all traffic at once; rollback is switching back. Canary sends a small share of traffic (say 5%) to the new version, compares error rate and latency, then widens or aborts. App Service deployment slots are blue-green in a box: deploy to staging, warm it up, swap, and swap back to roll back.

    The catch is the same for all of them: for a while two versions run against one database, so schema changes must be expand/contract and backward compatible. The trade-off is cost and complexity (blue-green and canary) against blast radius and rollback speed.

  2. When: Candidate mentions the regression suite running on every pull request. Why: Checks the candidate can run and report test suites in CI.
    How to answer

    dotnet test builds the test projects and runs them through the test platform, using the adapter the project references (xUnit, NUnit or MSTest). I use --filter to pick tests, for example --filter "Category=Unit&FullyQualifiedName~Orders". I use --logger trx so CI can show the results, and --collect "XPlat Code Coverage" with Coverlet for coverage, which I turn into a report. When tests hang or crash, --blame-hang-timeout and --blame-crash capture dumps. The command exits non-zero on failure, so the pipeline fails. In .NET 10 the SDK can also run in Microsoft.Testing.Platform mode, which you opt into in global.json.

More in Test Types

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me