Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode
[org-mode.git] / testing / README.org
blobf374a48deade2f646b50b2e178b565785b4a495f
1 #+Title: Org-mode Testing
2 #+Babel: results silent
4 The following instructions describe how to get started using the
5 Org-mode test framework.
7 1) Install the ERT and jump.el testing dependencies which are included
8    as git submodules in the org-mode repository.  To do so run the
9    following git submodule commands from inside the base of the
10    Org-mode directory (or just execute the following code block).
11    #+begin_src sh
12      cd ..
13      git submodule init
14      git submodule update
15    #+end_src
17 2) Load the [[file:org-test.el][org-test.el]] file
18    #+begin_src emacs-lisp
19      (load-file "org-test.el")
20    #+end_src
22 3) The =org-test-jump= command is now bound to =M-C-j= in all
23    emacs-lisp files.  Call this command from any file in the =lisp/=
24    directory of the org-mode repository to jump to the related test
25    file in the =testing/= directory.  Call this functions with a
26    prefix argument, and the corresponding test file will be stubbed
27    out if it doesn't already exist.
29 4) Review the ERT documentation, to do this run =makeinfo= in the
30    =testing/ert= directory,
31    #+begin_src sh
32      cd ert
33      makeinfo ert.texinfo
34    #+end_src
35    then browse the [[elisp:(info (expand-file-name "ert/ert.info"))][resulting info file]].
37 5) A number of org-mode-specific functions and macros are provided in
38    =org-test.el= see the [[file:org-test.el::%3B%3B%3B%20Functions%20for%20writing%20tests][;;; Functions for Writing Tests]] subsection of
39    that file.  Some of these functions make use of example org-mode
40    files located in the [[file:examples][examples/]] directory.
42 6) Functions for loading and running the Org-mode tests are provided
43    in the [[file:org-test.el::%3B%3B%3B%20Load%20and%20Run%20tests][;;; Load and Run Tests]] subsection, the most important of
44    which are
45    - =org-test-load= which loads the entire Org-mode test suite
46    - =org-test-current-defun= which runs all tests for the current
47      function around point (should be called from inside of an
48      Org-mode elisp file)
49    - =org-test-run-all-tests= which runs the entire Org-mode test suite
50    - also note that the =ert= command can also be used to run tests