EGit Contributor Guide - Tests

# Tests

## JGit Unit Tests

The JGit unit tests are executed during the maven build. To run them from the Eclipse workbench use the launch configurations which are part of the sources of the test bundles'.

## JGit HTTP Tests

The JGit HTTP tests in org.eclipse.jgit.http.test rely on the Jetty web container.

To run these tests from Eclipse the Jetty feature is needed. Use one of the target platforms as described in dependencies.

Alternatively, install "Jetty 7.6.11.v20130520" from http://download.eclipse.org/jetty/updates/jetty-bundles-7.x/7.6.11.v20130520/ .

## EGit Core Tests

The EGit Core tests are executed during the maven build for the bundle org.eclipse.egit.core.test.

To run them from the Eclipse workbench use the launch configuration which is part of the sources of the test bundle org.eclipse.egit.core.test.

## EGit UI Tests

The EGit UI tests are using SWTBot, using the 'SWTBot for Eclipse Testing' feature.

You need to install at least "SWTBot for Eclipse Testing" and "SWTBot IDE Feature":

- Juno and Kepler: http://download.eclipse.org/technology/swtbot/releases/2.1.0/

Starting a UI test from Eclipse:

- select the test class or test method
- click Run As > SWTBot Test

Do not touch the mouse or keyboard when the UI test is running since this may disturb the UI test by e.g. moving the current focus to another window.

### During Maven Build

The tests are executed in the integration-test phase of the default Maven lifecycle.

If you want to skip execution of UI tests (only execute core tests):

    mvn -P skip-ui-tests clean install

If you want to skip all tests:

    mvn clean install -Dmaven.test.skip=true

## Auxilary testing tools

Any code, including testing code, does not always do what you expected it to. The most common failure is probably the failure to actually execute the part of the code you wanted to test. Code coverage tools like EclEmma can easily visualize what part of the code is being executed.