项目作者: STAMP-project

项目描述 :
Maven plugin to handle multi module projects for PiTest
高级语言: Java
项目地址: git://github.com/STAMP-project/pitmp-maven-plugin.git
创建时间: 2017-10-04T16:07:05Z
项目社区:https://github.com/STAMP-project/pitmp-maven-plugin

开源协议:GNU Lesser General Public License v3.0

下载


PitMP: Maven plugin to handle multi module projects for PiTest

Build Status
Coverage Status
Maven Central

Table of contents

Quick start

  • on command line

    • Compile your project
      1. mvn install
    • and run PIT
      1. mvn eu.stamp-project:pitmp-maven-plugin:run
    • or run Descartes
      1. mvn eu.stamp-project:pitmp-maven-plugin:descartes
  • with Maven
    Modify your pom.xml,

    • for PIT include:
      1. <plugin>
      2. <groupId>eu.stamp-project</groupId>
      3. <artifactId>pitmp-maven-plugin</artifactId>
      4. <version>1.3.7</version>
      5. </plugin>
    • and for Descartes include:
      1. <plugin>
      2. <groupId>eu.stamp-project</groupId>
      3. <artifactId>pitmp-maven-plugin</artifactId>
      4. <version>1.3.7</version>
      5. <configuration>
      6. <mutationEngine>descartes</mutationEngine>
      7. </configuration>
      8. </plugin>

      Note

      ```
      PitMP works only from the top level directory of your project.
      “cd ; mvn eu.stamp-project:pitmp-maven-plugin:run” will NOT work.

c.f. properties targetModules and skippedModules to specify in which directories you want to run PitMP.

  1. ## What is PitMP?
  2. PitMP (PIT for Multi-module Project) is a Maven plugin able to run PIT on multi-module projects.
  3. PIT is a mutation testing system for Java applications, which allows you to evaluate
  4. the quality of your test suites.
  5. To know more about PIT: http://pitest.org
  6. ## How does PitMP work?
  7. PIT takes a test suite, a set of classes to be mutated and a set of mutation operators
  8. and computes a line coverage and a mutation coverage:
  9. ![PIT inputs and outputs](docs/pit_inputs_outputs.png)
  10. PIT mutates only the classes defined in the same module than the
  11. test suite:
  12. ![PIT project](docs/pit_project.png)
  13. PitMP runs PIT on every test suite, mutating classes of all dependencies of modules
  14. located in the same project tree:
  15. ![PitMP project](docs/pmp_project_1.png)
  16. then:
  17. ![PitMP project](docs/pmp_project_2.png)
  18. etc...
  19. PitMP just extends PIT, it doesn't rewrite any feature, so all PIT's properties can
  20. be used.
  21. PitMP runs test suite as PIT does, just extending the list of classes to be
  22. mutated to the whole project tree, instead of mutating only the classes of
  23. the test suite module.
  24. ## PitMP Output
  25. PIT produces a report that includes:
  26. * a summary of line coverage and mutation coverage scores:
  27. ![PIT summary](docs/pit_summary_dnoo.png)
  28. * a detail report for each class combining line coverage and mutation coverage
  29. information:
  30. ![PIT detail](docs/pit_detail_dnoo.png)
  31. *Light green shows line coverage, dark green shows mutation coverage.*
  32. *Light pink show lack of line coverage, dark pink shows lack of mutation coverage.*
  33. ## Running PitMP on your project
  34. * Go to the project on which you want to apply PIT
  35. * Compile your project

mvn install

  1. * Run PIT on your multi module project :-)

mvn eu.stamp-project:pitmp-maven-plugin:run

  1. ##### Install the plugin for releases earlier than 1.1.4
  2. Since 1.1.4 PitMP is available on Maven Central, so this step is required only
  3. for releases before 1.1.4.

git clone https://github.com/STAMP-project/pitmp-maven-plugin.git
cd pitmp-maven-plugin
mvn install

  1. ### Configure PitMP
  2. You can configure your project in the root pom.xml, in the section \<plugins\>:


eu.stamp
pitmp-maven-plugin
release.you.want



a.package.of.classes
another.package.of.classes



  1. ### PitMP properties
  2. * targetModules: to run PIT only on specified modules, this
  3. attribute filters directories where to run PIT, not classes
  4. to be mutated
  5. You can use the property "targetModules" in the pom.xml:
  1. <targetModules>
  2. <param>yourFirstModule</param>
  3. <param>anotherModule</param>
  4. </targetModules>
  1. or on the command line, use:

mvn “-DtargetModules=yourFirstModule,anotherModule” pitmp:run

  1. Running PitMP from a module directory will NOT work.
  2. * skippedModules: to skip specified modules when running PIT, this
  3. attribute filters directories where to run PIT, not classes
  4. to be mutated
  5. You can use the property "skippedModules" in the pom.xml:
  1. <skippedModules>
  2. <param>aModuleToSkip</param>
  3. <param>anotherModuleToSkip</param>
  4. </skippedModules>
  1. or on the command line, use:

mvn “-DtargetModules=aModuleToSkip,anotherModuleToSkip” pitmp:run

  1. * targetDependencies: take only into account classes of targetDependencies, i.e.
  2. only code in targetDependencies will be mutated; it impacts PIT's targetClasses
  3. Note that only targetDependencies shall contains only modules of the project
  4. * ignoredDependencies: ignore classes of ignoredDependencies, i.e.
  5. code in targetDependencies will not be mutated; it impacts PIT's targetClasses
  6. If a module is both in targetDependencies and ignoredDependencies, it will be ignored.
  7. * continueFromModule: to run PIT starting from a given project (because continuing an aborted execution with Maven -rf is not working)
  1. <continueFromModule>aModule</continueFromModule>
  1. ## Running Descartes
  2. If you want to run Descartes:

mvn eu.stamp-project:pitmp-maven-plugin:descartes

  1. If you want to configure Descartes, add to your root project pom.xml, in the section \<plugins\>:


eu.stamp
pitmp-maven-plugin
release.you.want



a.package.of.classes
another.package.of.classes


descartes

  1. For complete instructions about Descartes see the [Descartes github](https://github.com/STAMP-project/pitest-descartes).
  2. For an example of multi module project using PitMP see the [dnoo github](https://github.com/STAMP-project/dnoo).
  3. ### Check Pseudo/Partially Tested Methods number
  4. If you want to check the number of Pseudo Tested Methods and/or Partially Tested
  5. Methods, you can add specific thresholds **pseudoTestedThreshold** and/or **partiallyTestedThreshold** in the configuration:


eu.stamp
pitmp-maven-plugin
release.you.want


1
1

a.package.of.classes
another.package.of.classes


descartes

  1. ### Break the build upon threshold crossing (mutation score or line coverage)
  2. The plugin can break the build, when the mutation score and/or line coverage is considered too poor.
  3. The example below breaks the build if mutation score is less than 40% or line coverage less than 60 %, according to "mutationThreshold" and "coverageThreshold" options:


eu.stamp-project
pitmp-maven-plugin
release.you.want

descartes
false
false
40
60


```

Notes concerning additional options:

  • “skip” option (default false): if set to true, the whole plugin execution is skipped (this can be parameterized).
  • “failWhenNoMutations” option (default true): if set to true, the build fails when there is no mutation.

Releases

For PIT release… use PitMP release… how to use PitMP
1.4.7 1.3.7 Maven Central
1.4.2 1.3.5, 1.3.6 Maven Central
1.4.0 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.0 Maven Central
1.3.2 1.1.6, 1.1.5 Maven Central
1.3.1 1.1.4 Maven Central
1.2.1, 1.2.2, 1.2.4, 1.2.5, 1.3.0 not tested
1.2.0, 1.2.3 1.0.1 git clone & mvn install
  • pitmp-maven-plugin-1.3.7

    • Dependency on Descartes v1.2.5
  • pitmp-maven-plugin-1.3.6

    • Dependency on Descartes v1.2.4
    • Tested with PIT v1.4.2, Descartes v1.2.4, JUnit4 and JUnit5
    • Fixed issues:
      #19,
    • Updating reference files for automated tests
      (missing automated results checking)
    • Tested on Ubuntu 18.04.1 LTS
  • pitmp-maven-plugin-1.3.5

    • Dependency on Descartes v1.3.4
    • Tested with PIT v1.4.2, Descartes v1.3.4, JUnit4 and JUnit5
    • Adding properties targetDependencies, ignoredDependencies and continueFromModule
    • Adding a module with no test in automated test suite
    • Running automated tests with XML report option and adding reference files
      (missing automated results checking)
    • Fixed issues:
      #16,
      #17,
      #20,
      #21,
      #22,
      #27,
    • Tested on Ubuntu 18.04.1 LTS
  • pitmp-maven-plugin-1.3.4

    • Dependency on Descartes v1.2.4 (hotfix for a regression in 1.3.3)
    • Tested with PIT v1.4.0, Descartes v1.2.4, JUnit4 and JUnit5
    • Tested on Ubuntu 16.04.4 LTS
  • pitmp-maven-plugin-1.3.3

    • Dependency on Descartes v1.2.3
    • Tested with PIT v1.4.0, Descartes v1.2.3, JUnit4 and JUnit5
    • Tested on Ubuntu 16.04.4 LTS
  • pitmp-maven-plugin-1.3.2

    • Dependency on Descartes v1.2.2
    • Tested with PIT v1.4.0, Descartes v1.2.2, JUnit4 and JUnit5
    • Fixed issues:
      #13
    • Tested on Ubuntu 16.04.4 LTS
  • pitmp-maven-plugin-1.3.1

    • Dependency on Descartes v1.2.1
    • Tested with PIT v1.4.0 and Descartes v1.2.1
    • Tested on Ubuntu 16.04.4 LTS
  • pitmp-maven-plugin-1.3.0

    • Adding a goal ‘descartes’
    • Dependency on Descartes v1.2
    • Tested with PIT v1.4.0 and Descartes v1.2
    • Tested on Ubuntu 16.04.4 LTS
  • pitmp-maven-plugin-1.2.0

    • Tested with PIT v1.4.0 and Descartes v1.2
    • Tested on Ubuntu 16.04.4 LTS
  • pitmp-maven-plugin-1.1.6

    • Tested with PIT v1.3.2
    • Fixed issues:
      #10
    • Tested on Ubuntu 16.04.4 LTS
  • pitmp-maven-plugin-1.1.5

    • Tested with PIT v1.3.2
    • Fixed issues:
      #6,
      #7,
      #9
      (Duplicate #6)
    • Add automatic tests (verify_pitmp.sh)
    • Limitation: #10
    • Tested on Ubuntu 16.04.4 LTS
  • v1.1.0, pitmp-maven-plugin-1.1.4

    • Tested with PIT v1.3.1
    • Tested on Ubuntu 16.04.4 LTS
  • v1.0.1

    • Tested with PIT v1.2.0 and Descartes v0.2-SNAPSHOT
    • Tested with PIT v1.2.3
    • Tested on Ubuntu 16.04.4 LTS

Feedbacks are welcome ! :-)