ERT: Emacs Lisp Regression Testing

ERT is a tool for automated testing in Emacs Lisp. Its main features are facilities for defining tests, running them and reporting the results, and for debugging test failures interactively.

ERT is similar to tools for other environments such as JUnit, but has unique features that take advantage of the dynamic and interactive nature of Emacs. Despite its name, it works well both for test-driven development (see http://en.wikipedia.org/wiki/Test-driven_development) and for traditional software development methods.

Introduction A simple example of an ERT test.
How to Run Tests Run tests in Emacs or from the command line.
How to Write Tests How to add tests to your Emacs Lisp code.
How to Debug Tests What to do if a test fails.
Extending ERT ERT is extensible in several ways.
Other Testing Concepts Features not in ERT.
GNU Free Documentation License The license for this documentation.

Detailed Node Listing

How to Run Tests
Running Tests Interactively Run tests in your current Emacs.
Running Tests in Batch Mode Run tests in emacs -Q.
Test Selectors Choose which tests to run.
How to Write Tests
The should Macro A powerful way to express assertions.
Expected Failures Tests for known bugs.
Tests and Their Environment Don't depend on customizations; no side effects.
Useful Techniques Some examples.
How to Debug Tests
Understanding Explanations How ERT gives details on why an assertion failed.
Interactive Debugging Tools available in the ERT results buffer.
Extending ERT
Defining Explanation Functions Teach ERT about more predicates.
Low-Level Functions for Working with Tests Use ERT's data for your purposes.
Other Testing Concepts
Mocks and Stubs Stubbing out code that is irrelevant to the test.
Fixtures and Test Suites How ERT differs from tools for other languages.
Appendix
GNU Free Documentation License The license for this documentation.

Copyright © 2008, 2010–2014 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License”.

(a) The FSF's Back-Cover Text is: “You have the freedom to copy and modify this GNU manual.”