Skip to content

Run only specified tests

Ondřej Machulda edited this page Nov 9, 2017 · 3 revisions

You often don't want to run whole test suite - especially when debugging tests and running them locally.

There are several ways to define which tests you want to run by Steward.

Run only one testcase class

Use --pattern option and specify whole file name:

vendor/bin/steward run staging chrome --pattern ProductDetailTest.php -vvv

Run only one test method of one testcase class:

Combine --pattern with --filter to run only one method of one file:

vendor/bin/steward run staging chrome --pattern ProductDetailTest.php --filter shouldAddProductsToCart -vvv

Run group of tests

This will run only testcase classes having @group annotation like this:

/**
 * @group login
 * @group foo
 */
class LoginTest extends AbstractTestCase
{
...
}
vendor/bin/steward run staging chrome --group login -vvv

Multiple groups could be selected to be run:

vendor/bin/steward run staging chrome --group login --group checkout -vvv

Exclude group of tests

You can use --exclude-group option to exclude specific group of tests:

vendor/bin/steward run staging chrome --exclude-group login -vvv

Also note --exclude-group and --group options could be combined:

vendor/bin/steward run staging chrome --group account --group checkout --exclude-group login -vvv