Typorithm · easy

2. Acceptance criteria and requirement review

qatestingtest-designindependent-practice
Saved on this device
Full lesson · 4 learning steps Open any exercise for focused practice
1

Step 1 of 4 · intro card

2. Acceptance criteria and requirement review

0%

Concept and contract

Resolve ambiguity before automating a product assumption.

An acceptance criterion describes externally meaningful behavior under stated conditions. It should identify the starting state, action and observable result without requiring knowledge of internal method names. A vague phrase such as search works leaves case handling, whitespace, empty input and filter combinations unresolved.

Review requirements before execution. Ask which interpretation users expect and record open questions rather than silently choosing one. This static review can prevent expensive rework even when no test script has been written yet.

Mechanism and worked example

The example specifies a country-and-query result using the companion fixture’s stable role ids.

The example specifies a country-and-query result using the companion fixture’s stable role ids. The country and query predicates combine with AND, and title matching ignores case after trimming. This is a small contract that can support manual, API and browser checks.

Given/When/Then is a communication structure, not proof by syntax. Keep each scenario focused on one meaningful rule and include enough fixture context to explain the expected result. A list of UI clicks with no business outcome is not a useful acceptance criterion.

Complete worked example

json

{
  "given": "Roles r1-r4 from the local fixture",
  "when": {
    "country": "UA",
    "q": " QA "
  },
  "then": {
    "ids": [
      "r1"
    ]
  },
  "rule": "Country AND normalized title query"
}
Reasoning
The criterion supplies both the normalization rule and the exact expected ids.

Counterexamples and common mistakes

The weak scenario says results are correct without defining which roles should appear.

The weak scenario says results are correct without defining which roles should appear. It cannot distinguish an empty result, all roles or the expected subset. Adding more automation around that sentence would make the assumption faster to repeat, not more justified.

Avoid hiding undecided requirements in test code. If empty search should mean all country-matching roles, write that explicitly. If it should mean no results, that is a different product decision and needs a different oracle.

Counterexample: what this check misses

json

{
  "given": "The page exists",
  "when": "Search",
  "then": "Results are correct"
}
Reasoning
Correct is not an oracle until the acceptable outcome is stated.

Independent practice: small task

Write two criteria for the same filter: empty query with country US, and mixed-case query qa with country UA.

Write two criteria for the same filter: empty query with country US, and mixed-case query qa with country UA. Use the four fixture records and give the complete expected id list in original order. Begin by writing the first criterion in plain language.

Then express it as a small Given/When/Then record. Add one open question about searching company names, which this lesson’s contract does not include. The task develops clear scope rather than rewarding elaborate scenario syntax.

Step 1: List the US fixture ids manually. Step 2: Write the normalized UA query criterion.

Practice starter: solve before reading the solution

json

{
  "emptyUS": {
    "given": "TODO",
    "when": {
      "country": "US",
      "q": ""
    },
    "thenIds": "TODO"
  },
  "mixedCaseUA": {
    "when": {
      "country": "UA",
      "q": "qA"
    },
    "thenIds": "TODO"
  },
  "openQuestion": "TODO"
}
Reasoning
Write one plain-language rule before choosing scenario notation.
  • Hint 1: An empty query still respects the selected country.
  • Hint 2: Keep unresolved behavior outside the accepted outcome.

Solution, tests and trade-offs

The solution expects r2 and r4 for an empty US query, and r1 for the normalized UA query.

The solution expects r2 and r4 for an empty US query, and r1 for the normalized UA query. The company-name question remains open instead of being asserted as implemented. This preserves the difference between an agreed requirement and a useful suggestion.

The lab verifies the stated fixture results, while review checks that the criterion is observable and independent. If the fixture changes, review expected ids deliberately rather than regenerating them from the new implementation automatically.

Practice solution and acceptance checks

json

{
  "emptyUS": {
    "given": "Unchanged r1-r4 fixture",
    "when": {
      "country": "US",
      "q": ""
    },
    "thenIds": [
      "r2",
      "r4"
    ]
  },
  "mixedCaseUA": {
    "when": {
      "country": "UA",
      "q": "qA"
    },
    "thenIds": [
      "r1"
    ]
  },
  "openQuestion": "Should company names also be searched? Not part of the current title-only contract."
}
Reasoning
The solution keeps agreed behavior separate from an unresolved scope question.

Interview reasoning and next step

In interviews, describe an ambiguity you would raise before automating and explain its effect on the oracle.

In interviews, describe an ambiguity you would raise before automating and explain its effect on the oracle. Show one concrete criterion with a complete expected result. Avoid claiming that every acceptance criterion must use one particular notation.

Next, use equivalence partitions to choose representative inputs. A clear contract lets you reduce redundant cases without pretending that one successful input proves the entire feature.

Optional stretch — after the core task works: Add a criterion for clearing the country selection.

Computer practice: download the companion lab at https://applydjinn.com/typorithm/qa-lab-20261105.zip. Read its README, install the pinned tools and run the accepted examples before attempting a starter. The mobile reader preserves your reading and self-check progress; the local lab runs browser tests separately.

Resolve ambiguity before automating a product assumption.