Axiom-Based Testing

Unit testing is an important part of the software development process, but coming up with comprehensive unit tests can be a major challenge. Axiom-based testing (also known as property-based testing or specification-based testing) provides a systematic way to develop comprehensive test suites, where the behaviour of program components are described using axioms. The axioms state algebraic properties about the operations in a program. Attached to a concept, axioms can be used as interface specifications in generic programming, against which each implementation of an interface can be tested.

Axioms are expressed as boolean functions, and need not be restricted to a particular logic, as in a specification language. Used in testing, each axiom is fed with a set of test data points and evaluated. If the axiom returns false, a possible error has been detected. Data can be generated randomly, or taken from a fixed set of data points.

Axiom-based testing is fundamental in the integration of specification and code in Magnolia experimental language. We also provide a tool, JAxT [HK08], for doing axiom-based testing in Java, and a library, Catsfoot [BDH11], adding axioms and concepts to C++ 2011.

Our Sophus library of coordinate-free numerical abstractions for PDE-solvers has been extensively tested using axiom-based testing. [HB05]


  • JAxT – Java Axiom Testing
  • Catsfoot – concept checking, concept-based overloading and axiom-based testing for C++ 2011.




  • Marco Poletti, visiting student

Related People


Anya Helene Bagge, Valentin David, and Magne Haveraaen. Testing with axioms in C++ 2011. Journal of Object Technology, 10:10:1-32, 2011. [ bib | DOI ]
Anya Helene Bagge, Valentin David, and Magne Haveraaen. The axioms strike back: Testing with concepts and axioms in C++. In GPCE '09: Proceedings of the eighth international conference on Generative programming and component engineering, pages 15-24, New York, NY, USA, 2009. ACM. [ bib | DOI ]
Magne Haveraaen and Karl Trygve Kalleberg. JAxT and JDI: The simplicity of JUnit applied to axioms and data invariants. In OOPSLA Companion '08: Companion to the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications, pages 731-732, New York, NY, USA, 2008. ACM. [ bib | DOI ]
Magne Haveraaen. Institutions, property-aware programming and testing. In LCSD '07: Proceedings of the 2007 Symposium on Library-Centric Software Design, pages 21-30, New York, NY, USA, 2007. ACM. [ bib | DOI ]
Magne Haveraaen and Enida Brkic. Structured testing in Sophus. In Eivind Coward, editor, Norsk informatikkonferanse NIK'2005, pages 43-54. Tapir akademisk forlag, Trondheim, Norway, 2005. [ bib | http ]