Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworks mutation testing docs #271

Closed
wants to merge 2 commits into from
Closed

Conversation

nunomaduro
Copy link
Member

No description provided.

Copy link
Contributor

@gehrisandro gehrisandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nunomaduro

Some suggestions to improve the docs to match the used terminology.

./vendor/bin/pest --mutate
```

Optionally, you may run mutation testing in parallel to speed up the process. Of course, your test suite must be able to run in tests in parallel.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Optionally, you may run mutation testing in parallel to speed up the process. Of course, your test suite must be able to run in tests in parallel.
Optionally, you may run mutation testing in parallel to speed up the process. Of course, your test suite must be able to run the tests in parallel.

./vendor/bin/pest --mutate --parallel
```

After running mutation testing, you will see a detailed report showing the number of mutations, how many were caught, and the mutation score.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
After running mutation testing, you will see a detailed report showing the number of mutations, how many were caught, and the mutation score.
After running mutation testing, you will see a detailed report showing the number of mutations, how many were untested, and the mutation score.


The higher the mutation score, the better your test suite is. A mutation score of 100% means that all mutations were "covered", which is the goal of mutation testing.

Now, if you see "uncovered" mutations, or are a mutation score below 100%, typically means that you have **missing tests** or that **your tests are not covering all the edge cases**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Now, if you see "uncovered" mutations, or are a mutation score below 100%, typically means that you have **missing tests** or that **your tests are not covering all the edge cases**.
Now, if you see "untested" mutations, or have a mutation score below 100%, typically means that you have **missing tests** or that **your tests are not covering all the edge cases**.

Comment on lines +58 to +65
<a name="covered-vs-uncovered-mutations"></a>
## Covered Vs Uncovered Mutations

When running mutation testing, you will see two types of mutations: **covered** and **uncovered** mutations.

- **Covered Mutations**: These are mutations that were detected by your test suite. They are considered "covered" because your tests were able to catch the changes introduced by the mutation.

As example, the following mutation is considered "covered" because the test suite was able to detect the change.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<a name="covered-vs-uncovered-mutations"></a>
## Covered Vs Uncovered Mutations
When running mutation testing, you will see two types of mutations: **covered** and **uncovered** mutations.
- **Covered Mutations**: These are mutations that were detected by your test suite. They are considered "covered" because your tests were able to catch the changes introduced by the mutation.
As example, the following mutation is considered "covered" because the test suite was able to detect the change.
<a name="tested-vs-untested-mutations"></a>
## Tested vs Untested and Uncovered Mutations
When running mutation testing, you will see three types of mutations: **tested**, **untested** and **uncovered** mutations.
- **Tested Mutations**: These are mutations that were detected by your test suite. They are considered "tested" because your tests were able to catch the changes introduced by the mutation.
As example, the following mutation is considered "tested" because the test suite was able to detect the change.

Comment on lines +87 to +89
- **Uncovered Mutations**: These are mutations that were not detected by your test suite. They are considered "uncovered" because your tests were not able to catch the changes introduced by the mutation.

As example, the following mutation is considered "uncovered" because the test suite was not able to detect the change.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Uncovered Mutations**: These are mutations that were not detected by your test suite. They are considered "uncovered" because your tests were not able to catch the changes introduced by the mutation.
As example, the following mutation is considered "uncovered" because the test suite was not able to detect the change.
- **Untested Mutations**: These are mutations that were not detected by your test suite. They are considered "untested" because your tests were not able to catch the changes introduced by the mutation.
As example, the following mutation is considered "untested" because the test suite was not able to detect the change.

```

Changing the return value is only one of many possible mutations. Typically, a mutation can be a change in the return value, a change in the method call, a change in the method arguments, and so on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Uncovered Mutations**: These are mutations were no test is excuting the mutated code at all. In this case it **always** means that a test is missing.

@nunomaduro nunomaduro closed this Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants