Groups Of Tests

Optionally, Pest allows you to assign tests to different groups with the group method. If you have a bunch of tests that are particularly slow, it might be good to add them all to the same group:

it('has home', function () {
    // ..

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:


Or a specific folder:

// Pest.php

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,browser

Note: The uses()->group('integration')->in('Feature') will not put any PHPUnit test class under the integration group. You still need the @group annotation for them. Pest will understand it.

Next section: Skipping Tests →