test-case-mode is a minor mode for running unit tests. It is extensible and currently comes with back-ends for JUnit, CxxTest, CppUnit, Python and Ruby.
The back-ends probably need some more path options to work correctly. Please let me know, as I'm not an expert on all of them.
test-case-mode works best with fringe-helper installed.
Add the following to your .emacs:
(add-to-list 'load-path "/path/to/test-case-mode") (autoload 'test-case-mode "test-case-mode" nil t) (autoload 'enable-test-case-mode-if-test "test-case-mode") (autoload 'test-case-find-all-tests "test-case-mode" nil t) (autoload 'test-case-compilation-finish-run-all "test-case-mode")
To enable it automatically when opening test files:
(add-hook 'find-file-hook 'enable-test-case-mode-if-test)
If you want to run all visited tests after a compilation, add:
(add-hook 'compilation-finish-functions 'test-case-compilation-finish-run-all)
Tests can be started with the commands M-x test-case-run or M-x test-case-run-all. If you want to run tests automatically after a compilation, use test-case-compilation-finish-run-all.
When a run has finished, the results appear in a buffer named "*Test Result*". Clicking on the files will take you to the failure location, as will M-x next-error and M-x previous-error.
Failures are also highlighted in the buffer. Hovering the mouse above them, or enabling test-case-echo-failure-mode shows the associated failure message.
The testing states are indicated visually. The buffer name is colored according to the result and a dot in the mode-line represents the global state. This behavior is customizable through test-case-color-buffer-id and test-case-mode-line-info-position.
If you have any feedback, please email me, or visit this package's page at the Emacs wiki.