Test Oracle
A test oracle is the basis used to decide whether observed behavior is correct. It may be an explicitly calculated result, a trusted reference, or a property justified by the specification.
For a tiny transformation, write expected rows from the business rule. Computing the expected answer with the same implementation under test can reproduce its mistake. A reference implementation also needs independent justification.
Choose what equality means: schema, duplicate multiplicity, order when required, and numeric tolerances. A set comparison loses repeated rows; matching counts or totals can hide different records. An unordered result should not fail merely because execution changed row order.
Check the oracle with a known wrong variant and retain the counterexample. Invariants and reference comparisons have limits; several implementations may share an error, and a passing sample does not establish correctness for all inputs.
See Testing and Debugging Spark Data Pipelines for worked examples.
Reference: Official documentation.
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
