Skip to content

Commit

Permalink
Static analysis, code style refactoring, method mathing refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarlvp committed Jul 16, 2023
1 parent dabf796 commit 89ee24f
Show file tree
Hide file tree
Showing 119 changed files with 5,033 additions and 4,389 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cd my-project-under-test
mvn clean package org.pitest:pitest-maven:mutationCoverage
```

All options from PIT can be used. For more details check the [the PIT documentation](https://pitest.org/quickstart/maven/).
All options from PIT can be used. For more details check [the PIT documentation](https://pitest.org/quickstart/maven/).

Check ["Running Descartes on your project"](#running-descartes-on-your-project) for additional Descartes configuration options.

Expand Down Expand Up @@ -65,7 +65,7 @@ If you use a multi-module project take a look at [PitMP](https://github.com/STAM
### Mutation testing
Mutation testing allows you to verify if your test suite can detect possible bugs.
The technique works by introducing small changes or faults into the original program. These modified versions are called **mutants**.
A good test suite should able to detect or *kill* a mutant. That is, at least one test case should fail when the test suite is executed with the mutant.
A good test suite should be able to detect or *kill* a mutant. That is, at least one test case should fail when the test suite is executed with the mutant.
[Read more](https://en.wikipedia.org/wiki/Mutation_testing).
Traditional mutation testing works at the instruction level, e.g., replacing ">" by "<=", so the number of generated mutants is huge, as the time required to check the entire test suite.
That's why the authors of [Will my tests tell me if I break this code?](http://dl.acm.org/citation.cfm?doid=2896941.2896944) proposed an *Extreme Mutation* strategy, which works at the method level.
Expand Down Expand Up @@ -399,7 +399,7 @@ PIT reporting extensions work with Descartes and include `XML`, `CSV` and `HTML`
Descartes also provides three new reporting extensions:
- a general reporting extension supporting `JSON` files. It works also with **Gregor**, the default mutation engine for PIT. To use just set `JSON` as report format for PIT.
- a reporting extension designed for Descartes that generates a JSON file with information about pseudo and partially tested methods. To use just set `METHOD` as report format for PIT.
- Descartes can generate a human readable report containing only the list of methods with testing issues by using the `ISSUES` format.
- Descartes can generate a human-readable report containing only the list of methods with testing issues by using the `ISSUES` format.

Examples of these reporting extensions for [Apache Commons-CLI](https://github.com/apache/commons-cli/tree/b9ccc94008c78a59695f0c77ebe4ecf284370956) can be checked [here](docs/examples/commons-cli).

Expand Down Expand Up @@ -498,7 +498,7 @@ To configure the stop methods under consideration Descartes provides a `STOP_MET
This feature is enabled by default. The parameter `exclude` can be used to prevent certain methods to be treated as stop methods and bring them back to the analysis. This parameter can take any of the following values:


|`exclude` | Method description | Example |
| `exclude` | Method description | Example |
|-----------------|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| `empty` | `void` methods with no instruction. | `public void m() {}` |
| `enum` | Methods generated by the compiler to support enum types (`values` and `valueOf`). | |
Expand Down Expand Up @@ -553,7 +553,7 @@ The feature can be completely disabled:
As said before, there are several reporting options provided by Descartes:
- `JSON` for a general mutation testing report using that file format. It can be used with **Gregor**.
- `METHODS` that produces a `methods.json` file with the list of all methods analyzed and categorized according to the mutation testing result.
- `ISSUES` a human readable report containing only the methods with testing issues.
- `ISSUES` a human-readable report containing only the methods with testing issues.

They can be configured and combined as regular PIT report formats:

Expand Down
14 changes: 14 additions & 0 deletions configuration/pmd-rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" ?>
<ruleset name="Descartes Coding Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">

<description>
Rules enforcing an accepted set of coding styles and best practices taken from PMD predefined rules.
This file customizes some of the rules to avoid false positives.
</description>

<rule ref="category/java/bestpractices.xml" />

</ruleset>
Loading

0 comments on commit 89ee24f

Please sign in to comment.