| title | description |
|---|---|
Groups Of Tests |
Groups Of Tests |
Optionally, Pest allows you to assign tests to different groups with the group method. If you have a bunch of
particularly slow tests, it might be good to add them all to the same group:
it('has home', function () {
// ..
})->group('integration');Of course, you can also assign a test to multiple groups:
it('has home', function () {
// ..
})->group('integration', 'browser');Sometimes, you may want to assign an entire file to a group:
uses()->group('integration');Or a specific folder:
// Pest.php
uses()->group('integration')->in('integration');Finally, you can run the tests of a specific group using the --group option while
running Pest on the command-line:
./vendor/bin/pest --group=integration,browserYou may also exclude specific groups using the --exclude-group option:
./vendor/bin/pest --exclude-group=apiNote: The
uses()->group('integration')->in('Feature')will not put any PHPUnit test class under the integration group. You still need the@groupannotation for them. Pest will understand it.
Next section: - Test Dependency →