API Testing & Quality Engineering
ConceptIntermediate 22 min· Strategy and career · 17 of 19

Test strategy for a real project

Knowing many testing tools is not the same as knowing what to test. Learn to decide what matters most, choose the right mix of tests, set entry and exit rules, and write a one-page test strategy a team will actually use.

You cannot test everything. A coffee shop's ordering API has endless possible inputs, and a team has a limited number of days. A test strategy is the set of decisions about *what* to test, *how deeply*, *with which kinds of tests*, *where they run* and *who is responsible*. It turns "we should test more" into a plan.

Think of a doctor with a limited time: they don't run every test on every patient. They look at the symptoms, the risks and the cost, then choose. Testing works the same way.

Step 1: start from risk

Risk = how likely something is to go wrong, times how bad it would be. Spend your effort where both are high.

For Brew & Bean, a wrong total on an order means customers are overcharged or the shop loses money: high impact, and pricing code changes often. A typo in the "About us" page is low impact. So pricing gets deep testing, and the About page gets a quick look.

A simple risk table for the coffee shop

FeatureLikelihood of bugsImpact if brokenTest depth
Order total calculationHigh (changes often)High (money)Deep: unit, boundary, API, integration
Order status flowMediumHigh (orders get lost)Deep: every allowed and disallowed move
Payment or UPI link (if added)MediumVery highDeep, plus security checks and manual exploratory testing
Menu displayLowMediumAPI test plus one end-to-end check
Phone number validationMediumMediumBoundary and negative tests
About page textLowLowManual glance

Step 2: choose the mix of tests

Each kind of test answers a different question (see *Why we test: the test pyramid and types of testing*). Use the cheapest test that can catch the bug.

Matching test types to questions

Test typeQuestion it answersSpeedTypical share
UnitDoes this function give the right answer?MillisecondsMany
API / integrationDo the endpoints, validation and database work together?SecondsA good number
ContractDo the API and its clients agree on the shape of data?SecondsA few per API
End-to-end (browser)Can a user complete the key journey?Tens of seconds eachFew: only the critical paths
Load / performanceDoes it stay fast with many users?MinutesA few scenarios, on a schedule
SecurityAre common weaknesses absent?MinutesAutomated scans plus targeted checks
Exploratory (manual)What did we not think of?HoursTime-boxed sessions before each release

A common mistake is the ice-cream cone: many slow, fragile browser tests and few unit tests. It looks thorough but is slow, flaky and hard to debug. Aim for a pyramid or a honeycomb (heavier on API and integration tests, common for services): most checks run below the browser, and the browser covers only a handful of critical journeys such as "browse the menu, place an order, see it as received".

Step 3: define the rules of the game

A strategy also says when testing starts and when it is "done enough". Write these as short rules everyone can check.

Rules to write down

  1. Definition of done for a feature: unit tests for new logic, API tests for new endpoints, negative cases covered, tests pass in CI, no open high-severity bugs.
  2. Entry criteria for QA: the feature is deployed to a test environment, test data exists, and the requirement is written down.
  3. Exit criteria for a release: all critical journeys pass, no open critical or high bugs, load test within the agreed limits, security scan has no high findings.
  4. Pull request rule: CI must be green before merge (see *Running tests in CI with GitHub Actions*).
  5. Bug rule: every bug that reaches production gets a test that would have caught it.

Step 4: test data and environments

Many test failures are not code bugs but data or environment problems. Decide in advance:

- Environments: local (developer), CI (clean, automatic), staging (like production, shared) and production (monitor only, no destructive tests). - Test data: create it inside the test (a factory like make_order), so each test is independent. Avoid depending on a shared record that someone may delete. - Secrets and personal data: use fake phone numbers and names. Never copy real customer data into a test environment. - Third parties: mock or use a sandbox for payment providers and SMS gateways, so tests are fast and free (see *Mocks, stubs and test doubles*).

Step 5: report bugs and measure what matters

A good bug report lets a developer reproduce the issue in two minutes: a clear title, steps, expected and actual result, environment, and evidence (response body, screenshot, log). Include severity (how bad the effect is) and let the product owner set priority (how soon to fix).

Measure things that drive decisions, and be careful with numbers that can be gamed. Useful: time for CI to give feedback, number of flaky tests, bugs found in production versus before release, how long a bug takes to fix. Misleading on its own: the raw count of test cases, or 100% code coverage. Coverage tells you which lines ran, not whether anything was checked.

The one-page strategy

Write the strategy so it fits on one page. A page that gets read beats a 40-page document that doesn't. Here is a template, shown as a prompt you can reuse with an AI tool, and then a short example.

Prompt · Draft a one-page test strategy
You are a senior QA lead. Draft a one-page test strategy for the project below. Use these headings: Scope (in and out), Top 5 risks, Test types and what each covers, Automation approach and tools, Environments and test data, CI pipeline, Entry and exit criteria, Roles, Open questions.

Project: [what it is, users, tech stack]
Team: [size, skills]
Release frequency: [weekly / monthly]
Biggest worry: [e.g. wrong prices, downtime, data leaks]

Keep it under 400 words and use plain English. Mark anything you assumed with (assumption).

What to expect: Check that the risks match your real worries, that every test type has a reason to be there, and that exit criteria are measurable. Delete anything generic.

strategy.md (example)
Brew & Bean ordering API: test strategy (summary)

Scope: GET /menu, POST /orders, GET /orders/{id}, PATCH /orders/{id}/status.
Out of scope: payments (not built yet), the admin dashboard.

Top risks: 1) wrong order totals, 2) invalid status jumps, 3) bad input
crashing the API, 4) slow responses at the 8 am rush, 5) customer phone
numbers exposed.

Tests: pytest unit tests for pricing; pytest API tests for every endpoint
(positive, negative, boundary); integration tests against Postgres; one
Playwright journey (browse, order, see status); k6 smoke test on every
deploy and a load test weekly; ZAP baseline scan weekly.

Pipeline: unit + API tests on every pull request (target under 3 minutes);
integration and e2e after those pass; load and security on a schedule.

Exit criteria for a release: all critical journeys green, no open
critical/high bugs, p95 response time under the agreed limit, ZAP scan has
no high findings.

Roles: developers write unit and API tests with their code; the QA engineer
owns the framework, exploratory sessions and the release checklist.

A short, specific strategy. Notice it names real endpoints and real risks, instead of generic sentences.

How this comes up in interviews

Interviewers for QA and SDET roles often ask: "How would you test this feature?" or "How would you design an automation framework?" Good answers follow the structure above: clarify the requirement, list risks, pick test types by cost and value, say what you would automate and what you would test by hand, and mention data, environments and CI.

Also expect "What would you not automate?" Good answers: one-off checks, tests of rapidly changing screens, and exploratory testing, where human curiosity finds what scripts can't.

Try it: Strategy for a new feature

Brew & Bean adds order scheduling: the customer picks a pickup time between 8 am and 10 pm, at least 15 minutes from now. In 20 minutes, write: (1) the top 3 risks, (2) which test types you would use and why, (3) five specific test cases including two boundary cases, (4) one thing you would test manually.

Key takeaways

  1. A test strategy answers what to test, how deeply, with which test types, where they run and who owns them.
  2. Start from risk: likelihood times impact decides where to spend effort.
  3. Use the cheapest test that can catch the bug: many unit tests, a good number of API tests, few browser tests.
  4. Write measurable entry criteria, exit criteria and a definition of done, and require green CI before merging.
  5. Create test data inside tests, mock third parties and never use real customer data.
  6. Keep the strategy to one page; be wary of vanity metrics such as test counts or coverage alone.

Check yourself

Finishing the quiz marks the lesson as done.

1. How do you decide which feature deserves the deepest testing?

2. Which describes the 'ice-cream cone' anti-pattern?

3. A bug reached production. According to a good strategy, what happens next besides fixing it?

4. Why is 100% code coverage a poor goal on its own?

5. Which test should NOT usually run on every pull request?

Saved on this device. Create a free account to keep it on every device.

Practise this with Sam

A real mock interview, out loud, with an honest scorecard. Free to start.

Start free