https://github.com/rranelli/maven-test-mode.git
git clone 'git://github.com/rranelli/maven-test-mode.git'
This minor mode provides some enhancements to java-mode in order to use maven test tasks with little effort. It's largely based on the philosophy of `rspec-mode' by Peter Williams. Namely, it provides the following capabilities:
toggle back and forth between a test and it's class (bound to \C-c ,t
)
verify the test class associated with the current buffer (bound to \C-c ,v
)
verify the test defined in the current buffer if it is a test file (bound
to \C-c ,v
)
verify the test method defined at the point of the current buffer (bound
to \C-c ,s
)
re-run the last verification process (bound to \C-c ,r
)
run tests for entire project (bound to \C-c ,a
)
Check the full list of available keybindings at maven-test-mode-map
.
maven-test-mode
defines a derived minor mode maven-test-compilation
which
allows one to jump from compilation errors to text files.
You can install via MELPA
, or manually by downloading maven-test-mode
and
adding the following to your init file:
(add-to-list 'load-path "/path/to/maven-test-mode")
(require 'maven-test-mode)
If maven-test-mode
is installed properly, it will be started automatically
when java-mode
is started.
If you prefer the more ‘verbose’ maven
output, change the default of
maven-test-test-task-options
:
(setq maven-test-test-task-options "")
In order to map between the class file and it's test, maven-test-mode
uses the
variable maven-test-class-to-test-subs
. This variable specifies a list of
substitution pairs (REPLACE . BY)
that will be applied to the class file path
in order to find the corresponding test file:
(s-replace-all subs (buffer-file-name))
If your project does not comply with the default convention, you need to change the value of this variable.
In order to identify which test method is immediately defined before point,
maven-test-mode
uses the regexes defined at
maven-test-test-method-name-regexes
. If your test method definition does not
match the default regexes, you need to add your custom regex to the list with
something like:
(add-to-list 'maven-test-test-method-name-regexes "my-special-regex")
Love Emacs? Great, help out by contributing. The easiest way to contribute is to checkout the git project, make a change and then submit a pull request.
This package is largely inspired in rspec-mode by Peter Williams.