# Emacs Lisp Regression Testing

## Table of Contents

- 1 Introduction
- 2 How to Run Tests
  - 2.1 Running Tests Interactively
  - 2.2 Running Tests in Batch Mode
  - 2.3 Test Selectors
- 3 How to Write Tests
  - 3.1 The `should` Macro
  - 3.2 Expected Failures
  - 3.3 Tests and Their Environment
  - 3.4 Useful Techniques when Writing Tests
- 4 How to Debug Tests
  - 4.1 Understanding Explanations
  - 4.2 Interactive Debugging
- 5 Extending ERT
  - 5.1 Defining Explanation Functions
  - 5.2 Low-Level Functions for Working with Tests
- 6 Other Testing Concepts
  - 6.1 Other Tools for Emacs Lisp
  - 6.2 Fixtures and Test Suites
- Appendix A GNU Free Documentation License

Next: Introduction, Up: (dir) [Contents]

# ERT: Emacs Lisp Regression Testing

Copyright © 2008, 2010–2016 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.”

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.

Next: Introduction, Up: (dir) [Contents]