~/qa-guides

~/qa-guides/event-sequence-testing

>_ Event Sequence Testing: Ordered Pairs, Triples, and Test Cases

Build six event sequences for a task-list export. Check the file from each run, find an ordering defect that pair coverage misses, and recalculate coverage when Reset has a prerequisite.

Event sequence testingSequence covering arraysCombinatorial testingTest design

Published

Short answer

Event sequence testing varies the order of actions and checks the result of each execution. An ordered pair asks whether one event occurred before another in the same run. An ordered triple asks whether three events occurred in a particular order. Unless a test calls for consecutive steps, other events may occur between them.

Consider a task list with an export button. Filter the list, sort it, export it, and reset the view. Now repeat the test with Reset just before Export. Both runs finish with the same rows on screen. The first file should contain only the filtered rows in the chosen order. The second should contain the full list in its default order. An assertion on the final screen alone would accept either file.

Define the four events and the export rule

Start each test with a fresh copy of a task list. Task 101 is Open, 102 is Closed, and 103 is Open. The default view shows all three tasks in ascending numeric ID order. No task changes status during a run. Two open tasks make a sorting error visible even when the filter is active. The closed task makes a stale filter visible after a reset.

Each complete test applies all four actions exactly once.

  • F applies the Open filter and preserves the current sort order.
  • S sets the sort to descending ID and preserves the current filter.
  • E exports a snapshot of the visible rows, in their current order, at the moment the export is accepted. Export leaves the view as it was.
  • R resets both the filter and the sort to their defaults. In the first version of the example, the application accepts Reset even when the view is already at its defaults.

Read the letters from left to right. Before starting the next action, confirm that the application applied the previous one or accepted its export request. If Reset starts a run, the screen already shows the defaults. Use the application's acknowledgement to establish that Reset actually ran.

The CSV has one column named id and one data row per task. In the tables below, 103, 101 means two successive data rows, first 103 and then 101. Use a separate file or export request ID for each run.

These rules specify what to check even when a file takes time to download. The export request fixes the snapshot. Later changes to the view must leave the file for that request intact. If your product instead builds a file from the data available when a worker starts, define that observation point before assigning expected rows.

What counts toward event sequence testing coverage?

For four distinct events, there are four choices for the first member of an ordered pair and three choices for the second. The target is 4 x 3 = 12 ordered pairs. For triples there are two remaining choices for the third event, giving 4 x 3 x 2 = 24 ordered triples. Each target describes part of the history. A full run such as FSER contains one ordering of all four events and several shorter orders within it.

A sequence covering array is a set of runs that includes every required order at the chosen length, also called the strength. To check an order, read across a single run and keep the events named in the target. For example, keeping Filter, Export, and Reset in FSER yields FER. The intervening Sort is allowed. This use of ordered subsequences comes from the original work on combinatorial methods for event sequence testing.

Choose the coverage measure to match the question. For a dashboard configuration, Open and descending form a pair of selected values. A configuration test can show that they work together. For a file export, it also matters whether those settings took effect before the file was requested. If you are selecting combinations of values across parameters, the pairwise testing guide gives the corresponding coverage calculation.

Two runs cover every ordered pair

Execute FSER in one clean session and its reverse, RESF, in another. In the forward run every pair has one direction. Reversing the whole row reverses the direction of every pair. The six pairs of distinct events therefore appear in both directions across these two tests.

RunAccepted orderExpected CSV IDsWhy those rows appear
P1FSER103, 101Export sees the Open filter and descending sort
P2RESF101, 102, 103Export sees the default view before either setting changes

These runs cover 12 / 12 ordered pairs. To audit the triples, choose any three of the four events. For those three you have seen just the forward order and its reverse out of six possible orders. There are four ways to choose three events, giving 4 x 2 = 8 distinct triples covered out of 24.

Find the missing order behind a stale export

Suppose Reset updates the visible list but the exporter retains the last filter. P1 exports while Open is still the correct filter. P2 resets a fresh view, so there is no earlier filter to clear. Both exports can pass. The missing history is FRE, in which a filter has been set, Reset has cleared it, and Export then reads the result.

P1 contains Filter before Reset. P2 contains Reset before Export. Joining those observations would give credit for a history no account actually experienced. Check the three events against each row separately. P1 exports too early, and P2 applies the filter too late.

For a targeted regression test, run FSRE. After Sort, the screen should show 103, 101. After Reset, it should show 101, 102, 103. Export and compare the ordered IDs in the file with that last list. A file containing 101, 103 would be consistent with an exporter that used the current ascending sort and the old Open filter. Keep the file and the displayed list together as evidence.

P1 and this targeted test are also a useful control for each other. Both finish at the default view. Moving Export across Reset changes the expected file from 103, 101 to 101, 102, 103. The extra run contributes two previously unseen triples, FRE and SRE, bringing this particular three-run suite to 10 / 24. That may be enough for a focused regression on Reset. Covering all triples calls for a different selection of runs.

Six executable test cases for all ordered triples

The six cases below form a complete suite for three-event relative order in the four-action model. Start each row from the default view. Read its event order as steps, compare the downloaded file with the third column, and check the visible IDs after the fourth action against the last column. T1 is the same execution as P1. The six rows constitute their own suite.

CaseEvent orderExpected CSV IDs at EExpected visible IDs at finish
T1FSER103, 101101, 102, 103
T2EFRS101, 102, 103103, 102, 101
T3ESRF101, 102, 103101, 103
T4RFES101, 103103, 101
T5SFRE101, 102, 103101, 102, 103
T6RSEF103, 102, 101103, 101

To derive an expected file, stop reading the row at E. Start with the default view and apply only the actions to its left. In T6, Reset accepts the default view and Sort reverses all three IDs. Task 102 belongs in the middle of the file. Filter runs after the snapshot and removes 102 from the visible list. A test that compares the download to the screen at the end would incorrectly reject a correct export.

T4 catches a different error with the same final screen. The Open filter is already active when the snapshot is taken, so the file contains two rows. Sort takes effect only afterwards. A check on row count, or one that sorts both lists before comparing them, would accept 103, 101 as the file. The requirement specifies 101, 103. Preserve that order in the assertion.

Audit the triples in the six cases

For each run, drop one event and keep the other three in execution order. Each column below fixes a group of three events. The cell tells you which ordering of that group the test exercises. For example, T2 has order EFRS. In the column for Filter, Sort, and Export, drop Reset to obtain EFS.

CaseF, S, EF, S, RF, E, RS, E, R
T1FSEFSRFERSER
T2EFSFRSEFRERS
T3ESFSRFERFESR
T4FESRFSRFERES
T5SFESFRFRESRE
T6SEFRSFREFRSE

Read down any column. It contains all six permutations of those three letters, each exactly once. Across the four columns the suite therefore covers 24 / 24 distinct triples. Six runs are the minimum for this model. Even for just the group Filter, Sort, and Export, a single run can supply only one of its six possible orders.

There are also 4 x 3 x 2 x 1 = 24 possible full four-event orders. These runs exercise six of those complete histories and all 24 three-event orders. If a reported defect requires one exact four-step history, look up the whole row before treating its shorter orders as evidence.

When the actions must be consecutive

Suppose a defect report says that Reset immediately after Sort, immediately followed by Export, writes the wrong ordering. Now the target is the consecutive block SRE. T5 is the only test in the six-row suite that contains those letters in relative order. Its actual steps are SFRE. Applying Filter between Sort and Reset can change the behavior under investigation.

For a consecutive target, slide a window across the accepted steps. T5 has two three-step windows, SFR and FRE. Neither is SRE. Across all six rows there are 12 different consecutive triples, half of the 24 possible orders of three distinct events. The earlier targeted run FSRE ends with the exact block SRE and can serve both the stale-filter investigation and this adjacency check.

State which events count as intervening steps. In this task-list model, waiting for the sorted rows to appear is an observation. It does not insert another modeled event between Sort and Reset. If the reported defect depends on a background refresh arriving between them, include that refresh in the recorded history. A claim about elapsed time, such as Reset occurring before Sort has finished applying, needs evidence of that timing as well.

Recalculate coverage when Reset has a prerequisite

Now change one product rule. Reset is disabled at the default view and becomes available after Filter or Sort changes the view. Export still works from any view. Each of the four actions still appears exactly once in a complete accepted run.

Look at the relative order of F, S, and R. Of their six possible orders, RFS and RSF ask for Reset before either setting has changed. Each of those two orders has four places to insert E. That rules out eight of the original 24 full permutations and leaves 16 feasible complete orders.

For three-event coverage, exactly those two triples are infeasible. A triple that includes Export and Reset includes just one of the settings. If it asks for Reset before that setting, the other setting can enable Reset earlier in the full run. For example, the target RFE is feasible inside SRFE. A triple that omits Reset can always be completed by putting Reset last. The revised denominator is therefore 22 feasible triples. All 12 ordered pairs remain feasible, including Reset before Filter and Reset before Sort, each enabled by the other setting.

Repair the suite for the revised rule

T4 and T6 start with Reset and cannot run as written on this version. T1, T2, T3, and T5 are still feasible. Once the application has accepted all the steps in those four rows, their 16 distinct triples count toward the new denominator of 22. An automated driver that clicks the disabled control and moves on would give a misleading record of the first event in T4 or T6.

The following four additional tests fill the six gaps while preserving the four feasible cases. The last column lists only triples missing from those four retained cases.

Additional orderExpected CSV IDsPreviously missing triples
FRES101, 102, 103FES, RES
FRSE103, 102, 101RSE
SREF101, 102, 103REF, SEF
SRFE101, 103RFE

For SRFE, Sort enables Reset. Reset restores the ascending order, Filter selects the two open tasks, and Export captures 101, 103. This test supplies the missing RFE even though Reset is unavailable as a starting action. Combining the four retained and four additional rows gives evidence for 22 / 22 feasible triples if all eight run as specified.

Document why an order is impossible before removing it from the denominator. A control deliberately disabled by the new rule changes the model. If a control unexpectedly stops responding in an otherwise legal row, keep the target in the denominator and record where execution stopped. For a workflow with several prerequisites, the state transition testing guide shows how to derive allowed actions from the starting state and its guards.

Calculate coverage from a partially executed run

Return to the original rule with Reset available from the start. Suppose five of the six cases complete. In T3, Export captures the default view, Sort applies, and Reset restores the defaults. A rendering error then prevents Filter from taking effect. The planned order was ESRF and the observed prefix is ESR. The file still contains exactly the expected IDs because Export took place before the failure.

The five complete rows contribute 20 distinct triples. T3 contributes ESR, the one triple present in its observed prefix. That gives 21 of 24 ordered triples exercised. The three still missing are ESF, SRF, and ERF. They all require the final Filter. Record the last accepted action and the unchanged visible list with the failure. Rerunning the full T3 case after the problem is fixed supplies those three orders.

A wrong file leads to a different result. If every event was accepted in the planned order but T4 exported 103, 101, the suite can have 24 / 24 triple coverage and a failed export assertion. Keep the expected IDs, actual IDs, and export request identifier on the same test record. This gives the person investigating a way to distinguish a sorting defect from a test driver that picked up the previous run's file.

When adapting this calculation, list the feasible targets for the chosen model, extract the observed targets from each run, and take their union. Divide the number of distinct observed feasible targets by the number of feasible targets. Preserve each run's boundary. Appending the beginning of tomorrow's test to today's missing suffix can create an order that occurred in neither session.

FAQ

Start with the failure you want the tests to distinguish. If changing a sort before Export is sufficient to expose it, choose both orders and inspect the file. If it requires a setting to be applied, cleared, and then used by an export, keep that triple in one run. When all four actions have to occur in a specific order, add that exact case. For a small, cheap model you can run all 24 permutations and compare the outputs. The six-case suite is useful when executing or reviewing each additional case costs meaningful time.

Give the repeated action its own scenario and expectation. In FRFE, a user filters, resets, reapplies the filter, and exports. The expected file contains 101, 103. That checks whether the second filter takes effect after Reset. If the two occurrences serve distinct roles in a larger model, label those roles and preserve their required order. Simply counting Filter twice would leave unclear which occurrence preceded Export.

Use the point at which the product commits the change. If opening a filter menu only displays choices, treating the menu open as F would make an export of all rows look like a failed filtered export. When an uncommitted preview has behavior of its own, model opening, applying, or cancelling that preview as distinct actions and state which view Export should capture.

Look for a sequence number or an acknowledgement tied to the component that applied the changes. A browser log can say when a click was issued while the export service records when it accepted the snapshot. Timestamps with the same precision may leave the relative order ambiguous. If the order matters and you cannot recover it, rerun with a checkpoint that confirms the first action took effect before issuing the second.

Yes, if each run starts with the same task data, default view, and a distinguishable export. Reopening a page that remembers the last filter can change the very first observation. T2 begins by exporting and should capture all three IDs in ascending order. Check that starting view and clear any persisted preferences as test setup before beginning the recorded sequence.

Ready to turn this guide into a working QA project with statuses, comments, and CSV export?