Section 10.3

System test

Definition

A system test is a test that runs the complete system in a stated configuration and environment, and checks its externally visible behavior against the system’s requirements. For a device, the system is the hardware, the exact build of its software, the other devices it communicates with, the workload it serves and the faults it meets. The test observes the system only through its external interfaces, as a user would. It follows integration testing §10.2, which checks components in groups, and precedes acceptance testing, in which the customer judges the system.

The idea

Components that pass their unit and integration tests can still fail together on the real device. Firmware, the program built into a device, often runs straight from flash memory §6.6, the memory that keeps its content without power. On many microcontrollers §6.1, small computers on one chip, the processor cannot fetch instructions from flash while a page of it, a block of often a few KiB, is being erased. The processor waits until the erase finishes, which can take tens of milliseconds or more. A storage component that erases a page and a radio component that must answer within a fixed time can each be correct, and their integration test on a host computer can pass, while the real device misses radio deadlines whenever an erase coincides with traffic. Only a test of the complete, configured system brings the real erase time, the real radio timing and the real workload together.

A system test is like a test drive: the whole car, on a chosen road, in chosen weather. It answers whether this car, configured this way, does what it must under these conditions. It does not answer whether the car copes with ice if the drive took place in summer. The picture stops at one point. A car looks the same in every drive, while two builds of the same firmware with different settings are two different systems. A system test result is therefore always about a declared configuration.

How it works

  1. Fix and record the configuration. Hardware: board model and revision, chip, clock source, attached peripherals (devices such as sensors connected to the chip) and power source. Firmware: the exact source version, the build options, and the compiler with its version. Peers and environment: the other devices and their software versions, the distances and the radio environment.

  2. Fix the starting state, for example a freshly erased device, or one whose storage is nearly full or already worn by many erases.

  3. Define the workload: which operations, in which order, with which sizes, at which rate, and for how long.

  4. Define the admitted faults and how they are produced: resets, power cuts, lost or corrupted packets, radio interference. Producing faults on purpose during a test is called fault injection §10.28.

  5. Define the observations and the oracle: what is observed (replies, data read back after a restart, logs) and the rule that decides whether a run passed.

  6. Run, repeat and record every run, including the failed and the aborted ones.

  7. State the result for the recorded configuration only.

Setups that look alike test different systems:

Only the last includes the real radio link. An end-to-end test drives one complete user-level operation from its start to its final effect. A system test is usually end-to-end, but a test whose path includes a simulated part is not end-to-end.

Worked example

A device receives a 12-byte configuration object over a wireless link in two writes of 6 bytes each (6+6=126 + 6 = 12). The device checks the object, stores it in flash memory and switches to it. A first system test sends the object, waits for the device’s reply “accepted”, and passes when the reply arrives. The test runs 10 times on one board, within one power-on session, with the board powered from a laboratory supply. All 10 runs pass.

What this result covers:

Even if the 10 runs were independent trials with one fixed failure probability pp, 10 passes out of 10 would say little. A one-sided 95% upper confidence bound for pp is the value at which 10 passes in a row have probability 0.05: (1−p)10=0.05(1 - p)^{10} = 0.05, so 1−p=0.051/10≈0.7411 - p = 0.05^{1/10} \approx 0.741 and p≈0.259p \approx 0.259. The test shows, at best, that the failure probability is below about 26%. The rule of three §18.5.8, which gives 3/n3 / n as the approximate bound after nn passes and no failures, gives a similar 3/10=0.303 / 10 = 0.30, that is, 30%.

Stated precisely

A system test result has the form: with hardware HH, firmware build FF, peers and environment EE, starting state II, workload WW and admitted faults XX, the oracle OO accepted kk of nn runs.

The result supports a claim about a configuration that differs in any of HH, FF, EE, II, WW or XX only through a separate argument that the difference cannot change the outcome, or through tests of that configuration. It supports only the properties that OO checks. The count nn supports a statistical statement only if the runs were arranged to be independent, for example by starting each from a fresh state, and a statement about devices in general needs several devices.

Limits and common mistakes

A broad test can have a weak oracle. A status light that blinks after boot shows that the firmware started. It does not show that the stored configuration is right, that it survives a restart or that a client can still connect, unless the requirement ties the light to exactly those conditions.

A system test covers one configuration. Another board revision, another compiler version or other build options make another system.

Workloads applied from outside seldom reach rare internal states, such as a full memory or a failure in the middle of a write. Fault injection and unit tests §10.1, which run one component alone with chosen inputs, reach those states directly.

A laboratory is kinder than the field: steady power, short distances, a quiet radio environment, fresh flash. A result carries over to the field only for the conditions the test included.

System tests are slow, and a failure is hard to locate, because any component may be at fault. Logs and the results of lower-level tests narrow it down.

A system test is not an acceptance test. The system test checks the written requirements. An acceptance test checks whether the system serves its users, which can fail even when every written requirement is met. The two checks are often called verification, asking whether the system was built right, and validation, asking whether the right system was built.

Questions answered

Which hardware, firmware, workload, and fault conditions define the tested system?

The tested system is defined by a written record of everything that ran and everything it was exposed to, and a result applies only to that record. The record states:

The record also states the oracle, meaning which effects were actually checked: a reply, the stored bytes, or the state after a restart. A claim about any other hardware, firmware, workload or fault condition needs a test of that condition, or an argument that the difference cannot change the outcome.

Related entries: Integration test (§10.2), Test oracle (§10.5), Hardware-in-the-loop testing (§10.36), Experimental unit (§11.3), Fault injection (§10.28).