Certopolis

ISTQB Certified Tester Foundation Level

State transition testing coverage criteria for ISTQB CTFL

ISTQB's CTFL v4.0 syllabus covers three criteria. All states coverage exercises every state. Valid transitions coverage, also called 0-switch coverage, exercises every valid transition. All transitions coverage exercises every valid transition and attempts every invalid one. Full all transitions coverage guarantees the other two, and reaching full valid transitions coverage also means every state has been exercised.

State diagram vs state table

A state diagram models behaviour by showing the possible states and the valid transitions between them. An event starts a transition, and a guard condition can qualify it. Transitions are treated as instantaneous and may result in the software taking an action. The usual label is event [guard condition] / action. The guard and the action can be left out when they do not exist or do not matter to the tester.

A state table is an equivalent model. Its rows are states and its columns are events, together with guard conditions if there are any. Each cell is a transition and holds the target state and any resulting actions.

The difference that matters for testing: a state table shows invalid transitions explicitly, as empty cells. A state diagram shows only the valid ones.

How are the three coverage criteria measured?

All states coverage is the states exercised divided by all states. Valid transitions coverage is the valid transitions exercised divided by all valid transitions. All transitions coverage counts both kinds: transitions exercised (valid) or attempted (invalid), divided by every transition in the state table.

Example: a model has 4 states and 3 events, so its state table has 12 cells. 6 cells are filled, which means 6 valid and 6 invalid transitions. A suite that exercises all 6 valid transitions and attempts 3 invalid ones reaches 100% valid transitions coverage, 100% all states coverage, and 9 / 12 = 75% all transitions coverage.

All states coverage is the weakest of the three, because it can usually be reached without exercising every transition. Valid transitions coverage is the one used most often. The syllabus treats all transitions coverage as the minimum for mission-critical and safety-critical software.

What does a state transition test case look like?

A test case is usually a sequence of events. The events drive the system through a series of state changes, with actions where they are defined. One test case may cover several transitions, and usually does.

For invalid transitions, the syllabus recommends testing only one per test case. This helps avoid defect masking, where one defect prevents another from being detected.

Where the exam catches people

  • Believing a state diagram shows invalid transitions: only the state table shows them, as empty cells.
  • Reading empty cells in a state table as unfinished specification: they represent invalid transitions.
  • Dividing by the number of valid transitions when calculating all transitions coverage: the denominator is every cell, valid and invalid.
  • Believing 100% all states coverage means every transition was exercised: it is weaker than valid transitions coverage.
  • Writing a separate test case for every single transition: one test case normally covers several transitions. Only invalid transitions are best tested one per test case.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A state model has 5 states and 3 events, and its state table has 7 valid transitions. A test suite exercises all 7 valid transitions and attempts 2 of the invalid transitions. The event sequences of its test cases have been lost. Which of the following is TRUE about the coverage this suite achieves, with percentages rounded to the nearest whole number? Select ONE option.

    Right. In the game that’s Renown for your Test Analysis and Design building.

    Not that one: A is right. In the game your Test Analysis and Design building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Because every valid transition was exercised, every state was exercised too, so all states coverage is 100% even without the sequences.

    Written from istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf

  2. A team tests the booking workflow of a hotel system, modelled as a state diagram. Their exit criterion is that every arrow in the diagram has been followed by at least one test. Events that a state does not accept do not have to be tried. Which of the following coverage criteria does this exit criterion describe? Select ONE option.

    Right. In the game that’s Renown for your Test Analysis and Design building.

    Not that one: A is right. In the game your Test Analysis and Design building would lose a little Renown, and this question would come back later.

  3. A media player is modelled as a state table. Rows are states, columns are events, and "—" is an empty cell. Stopped: play → Playing | pause → — | stop → — Playing: play → — | pause → Paused | stop → Stopped Paused: play → Playing | pause → — | stop → Stopped The player starts in Stopped. Which of the following statements about this model is CORRECT? Select ONE option.

    Right. In the game that’s Renown for your Test Analysis and Design building.

    Not that one: D is right. In the game your Test Analysis and Design building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    A state diagram of the player draws arrows only for transitions that can happen, so nothing for pause would leave Stopped on it.

    Written from istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf

Ask for something