QA glossary

What is a test oracle?

A test oracle is whatever tells a tester what the right result is, so the actual result can be judged pass or fail. The ISTQB glossary defines it as "A source to determine an expected result." It can be a specification, an existing system, a calculation or an expert.

An example from QA practice

A payroll system is being replaced. For the new one, the old system is the oracle: the team runs last month's payroll through both and compares every payslip. Where they differ, someone checks the tax rules to decide which system is wrong. For a new bonus rule that the old system never had, the oracle is the written policy and a spreadsheet the finance team worked out by hand.

Common oracles

  • The test basis: requirements, acceptance criteria and specifications.
  • A previous version or a competing system that does the same job.
  • People: a domain expert's knowledge of what is correct.
  • An automated oracle: code that computes or checks expected results, used when inputs are generated or human checking costs too much.

The test oracle problem

Sometimes no affordable oracle exists. The ISTQB Test Analyst syllabus (CTAL-TA v4.0, section 1.3.4) names the usual causes: complex data, non-determinism such as in AI-based systems, probabilistic behaviour and missing or ambiguous requirements. For AI systems, the CT-AI v2.0 syllabus (section 4.1.3) suggests agreed ranges and tolerances in place of exact values.

Common questions

Can the code under test be its own oracle?

It should not be. If a test computes the expected value using the same logic as the code, a mistake in that logic appears on both sides and the test passes. Use an independent source instead: a hand-worked example, a different implementation, a trusted earlier version or a rule from the specification.

What is a pseudo-oracle?

A pseudo-oracle is a second, independently built version of the program used to produce expected results. If both versions give the same answer for the same input, the answer is more likely right. If they differ, at least one of them has a defect and someone must investigate. It is useful where the expected result is too costly to work out by hand.

What do you do when there is no oracle?

Weaker checks still help. Test properties the answer must have, such as a total not being negative, or relations between outputs, as in metamorphic testing. Ask a domain expert to review a sample. Log what was checked and what was not, so nobody assumes the unchecked part was covered.

How BetterQA does it

Every bug we file in BugBoard states the expected result next to the actual one, and the expected result names where it comes from: the requirement, the acceptance criterion or the behaviour the client confirmed. When an AI tool helps write a test or a report, an engineer reviews the result, and a test whose expected result cannot be traced to a source is not accepted.

Related terms

Further readingTest techniques

How testers choose what to check.

ServiceFunctional testing

Checking each feature against what it should do.