config/.vim/eclim/doc/vim/java/junit.txt

149 lines
4.2 KiB
Plaintext
Raw Normal View History

*vim-java-junit*
JUnit
*****
*:JUnitExecute* *:JUnitResult*
Executing test cases and viewing the results.
=============================================
When editing java source files eclim exposes a couple commands which
allow you to easily execute junit test cases and view the results.
First, please note that eclim does not attempt to provide a junit
execution environment. Instead the goal is to allow you to easily
interface with your favorite build tool (ant, maven, etc.).
The first of the commands is :JUnitExecute. This command is
responsible for executing the current test case or the test case
supplied as an argument.
The second command is :JUnitResult. This command is responsible for
locating and opening the result file for the current test case or the
test case supplied as an argument.
Note: Both commands support command completion of their respective
arguments as long as the settings defined below are defined
properly.
Configuration
=============
Eclim Settings
*org.eclim.java.junit.src_dir*
- org.eclim.java.junit.src_dir - Defines the location of the junit
test case source files. Currently this is only utilized for command
completion of test case names for :JUnitExecute. Supports
"<project>" key to represent the root directory of the current
project.
Ex.
>
org.eclim.java.junit.src_dir=<project>/src/test/junit
<
*org.eclim.java.junit.output_dir*
- org.eclim.java.junit.output_dir - Defines the location of the junit
test case results. Supports "<project>" key to represent the root
directory of the current project.
Ex.
>
org.eclim.java.junit.output_dir=<project>/build/test/results
<
*org.eclim.java.junit.command*
- org.eclim.java.junit.command - Defines the command used to execute a
test case.
Supports the following keys:
- <testcase>: key representing the requested test case to execute
using path separators.
Ex. org/test/SomeTest
Useful for use with ant and maven 2.x.
- <testcase_class>: key representing the fully qualified class name
of the requested test case to execute.
Ex. org.test.SomeTest
Useful for use with maven 1.x.
Ex.
>
# Ant, assuming you have a target 'test' supporting
# property 'junit.include'.
org.eclim.java.junit.command=Ant -Djunit.include=<testcase> test
# Maven 2.x using built in surefire plugin.
org.eclim.java.junit.command=Mvn -Dtest=<testcase> test
# Maven 1.x using built in test plugin.
org.eclim.java.junit.command=Maven -Dtestcase=<testcase_class> test:single
<
*:JUnitImpl*
Generating test method stubs.
=============================
While editing junit files, eclim provides functionality to generate
test method stubs similar to the method override / impl
(|vim-java-impl|) functionality provided for non-test-case classes.
The only difference is that instead of :JavaImpl, you use :JUnitImpl
to open the window of possible methods to implement.
To determine what class the current test case is for, eclim expects
that the standard naming convention for test cases is followed, where
the test case has the same fully qualified class name as the target
class with a 'Test' suffix.
For a class org.foo.bar.Baz, the exepected test case would be named
org.foo.bar.BazTest.
So when invoking :JUnitImpl from within org.foo.bar.BazTest, eclim
would look for the class org.foo.bar.Baz and generate a list of
methods to test from it.
When you hit <enter> on the method to add, if that method belongs to a
type in the hierarchy for the class being tested, then the
corresponding test method stub will be inserted, otherwise a regular
overriding stub will be generated.
Note: The insertion of methods is done externally with Eclipse and with
that comes a couple caveats (|vim-issues|).
Note: The junit.jar file must be in your project's classpath for eclim to
display possible methods to override in the junit test-case
hierarchy.
Configuration
=============
Eclim Settings
*org.eclim.java.junit.version*
- org.eclim.java.junit.version (Default: 4) - Specifies the primary
junit version being used, which determines which junit test method
template will be used to generated the test method stubs.
vim:ft=eclimhelp