[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mutation testing for Java in Eclipse IDE. Based on PIT (Pitest).

License

Notifications You must be signed in to change notification settings

pitest/pitclipse

Repository files navigation

ALE logo Pitclipse

Test your tests right into your IDE!

Java CI with Maven Java CI with Maven on Windows and Mac Technical Debt Coverage Lines of Code

Provides mutation coverage for your Java programs within the Eclipse IDE. Built on PIT (Pitest) for reliability.

What is mutation testing?

Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived.

The quality of your tests can be gauged from the percentage of mutations killed.

Henry Coles, pitest.org

Main Features

  • Reliability: relies on PIT (Pitest)
  • Customization: provides numerous preferences to tailor analysis
  • JUnit support: works with both JUnit 4 and JUnit 5 tests

Usage

Once the plug-in is installed (see Installation below), you can run Pitest:

  • Right-click on a Java project defining unit tests
  • Run As > PIT Mutation Test

Wait a few seconds, two views should open to show the results:

  • PIT Summary: shows the percentage of mutation coverage
  • PIT Mutations: shows the detected mutations and their location in code

It is also possible to run a single JUnit test class. Specific PIT options can be configured from the Launch Configuration window:

  • Run > Run Configurations...
  • Double-click on PIT Mutation Test
  • Specify the options
  • Press Run

Preferences also allow to change mutation settings (Window > Preferences > Pitest).

Installation

The plug-in is available in the Eclipse Marketplace.

Drag the following button to your running Eclipse workspace to start the installation:

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client
Or show how to install it manually
  1. Open Eclipse IDE
  2. Go to Help > Install New Software...
  3. Copy the update site’s URL in the Work with textbox (ATTENTION: the update site has changed on 5 May 2021, make sure you remove the previous one hosted on bintray):
  4. Hit Enter and wait for the list to load
  5. Check everything
  6. Click Next then Finish

Contributing

Requirements
Import the projects in the IDE
  1. File > Import... > Team > Team Project Set
  2. Fill URL with "https://raw.githubusercontent.com/pitest/pitclipse/master/eclipse-project-set.psf"
  3. Click on Finish

Tip: use Working Sets for a better workspace organization:

  • Open Project Explorer's menu > Top Level Elements > Working Sets
  • Open Project Explorer's menu > Select Working Sets > Check "bundles", "features", "tests" and "releng"
Setup the environment
  1. Open the org.pitest.pitclipse.target/org.pitest.pitclipse.target.target file
  2. Click on Set as Target Platform
  3. Wait for the dependencies to be loaded (may take a while)
Commit your changes
  1. Make some changes
  2. Make sure tests still pass: mvn clean verify
  3. Submit a PR

See CONTRIBUTING.md for further details.