Skip to content

[9.x] Adds artisan test --coverage documentation #7597

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

Merged
merged 4 commits into from
Jan 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [Creating Tests](#creating-tests)
- [Running Tests](#running-tests)
- [Running Tests In Parallel](#running-tests-in-parallel)
- [Reporting Test Coverage](#reporting-test-coverage)

<a name="introduction"></a>
## Introduction
Expand Down Expand Up @@ -166,3 +167,17 @@ Using the `ParallelTesting` facade, you may specify code to be executed on the `
If you would like to access to current parallel process "token" from any other location in your application's test code, you may use the `token` method. This token is a unique, string identifier for an individual test process and may be used to segment resources across parallel test processes. For example, Laravel automatically appends this token to the end of the test databases created by each parallel testing process:

$token = ParallelTesting::token();

<a name="reporting-test-coverage"></a>
### Reporting Test Coverage

When running your application tests, you may want to determine whether your test cases are actually covering the application code and how much application code is used when running your tests. To accomplish this, you may provide the `--coverage` option when invoking the `test` command:

php artisan test --coverage

<a name="enforcing-a-minimum-coverage-threshold"></a>
#### Enforcing A Minimum Coverage Threshold

You may use the `--min` option to define a minimum test coverage threshold for your application. The test suite will fail if this threshold is not met:

php artisan test --coverage --min=80.3