Log inStart free
LESSON 14.08 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Test oracles: property-based, metamorphic and differential tests

See three test oracles judge a buggy bounce simulator without an answer key.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 14.08 · TEST BAYSTART 6 M AT 1.5 M/S · END 3.5 M
01
Stage 1 of 6 · One run
The simulator should move a ball between walls at 0 m and 10 m. No answer key gives the right path.
Explain it simply

You see one run of a small physics simulator, the kind an RL environment steps. A ball starts at 6 metres and moves until it hits a wall and turns back. The question is whether this path is right. For a random start, nobody has the true path written down.

A path from 6 m at 1.5 m/s. It ends at 3.5 m after 8 s.

startsimulator pathmirrored path (dotted)referenceoracle rulefailure
wall 0 mwall 10 m0 s2 s4 s6 s8 s0510x (m)startone run, no answer keystep 6: x 9.75 → 9.5 m, v 1.5 → −1.2 m/swall 0 mwall 10 m0 s2 s4 s6 s8 s0510x (m)startone run, no answer keystep 6: x 9.75 → 9.5 m, v 1.5 → −1.2 m/s
Toy: a ball between walls at 0 and 10 m, 16 steps of 0.5 s
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
xk+1=xk+vk Δt,x>L⇒x→2L−x, v→−v\sy{x}{out}{x_{k+1}} = \sy{x}{out}{x_k} + \sy{v}{out}{v_k}\,\sy{dt}{param}{\Delta t},\quad x > \sy{L}{param}{L} \Rightarrow x \to 2L - x,\ v \to -v
x6=9.75+(1.5)⋅0.5=10.5→9.5, v6=−1.2x_{6} = 9.75 + (1.5) \cdot 0.5 = 10.5 \to 9.5,\ v_{6} = -1.2

Each step adds speed times 0.5 s; a wall reflects the ball.

Common mix-ups

MYTHIf every property and the mirror pass, the simulator is right.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With 8 tests, which oracle catches the inset walls bug?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.