Skip to content

Commit 9f9ff3a

Browse files
[9.x] Adds artisan test --coverage documentation (#7597)
* Adds test coverage documentation * Update testing.md * Update testing.md * Update testing.md Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent bc3f7a4 commit 9f9ff3a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

testing.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Creating Tests](#creating-tests)
66
- [Running Tests](#running-tests)
77
- [Running Tests In Parallel](#running-tests-in-parallel)
8+
- [Reporting Test Coverage](#reporting-test-coverage)
89

910
<a name="introduction"></a>
1011
## Introduction
@@ -166,3 +167,17 @@ Using the `ParallelTesting` facade, you may specify code to be executed on the `
166167
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:
167168

168169
$token = ParallelTesting::token();
170+
171+
<a name="reporting-test-coverage"></a>
172+
### Reporting Test Coverage
173+
174+
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:
175+
176+
php artisan test --coverage
177+
178+
<a name="enforcing-a-minimum-coverage-threshold"></a>
179+
#### Enforcing A Minimum Coverage Threshold
180+
181+
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:
182+
183+
php artisan test --coverage --min=80.3

0 commit comments

Comments
 (0)