mahmandev's avatar

How to only run a specific Dusk test?

I don't want to run all of them as it takes forever, only want to run the one I'm currently working on. Can't find anything online about it.

0 likes
6 replies
bastman69's avatar
Level 15
php artisan dusk tests/Browser/put-your-test-hereTest.php

you can use PHPUnit stuff. eg --filter and your method will run a specific method in your test file.

22 likes
zaymer.ru's avatar

How to run specific test in test file? like php artisan dusk tests/Browser/put-your-test-hereTest:testSomeFeature

arzola's avatar

Hey @Zaymer

You can do it using --filter option

php artisan dusk --filter testSomeFeature

3 likes
impbob36's avatar

You can also specify by class::test

php artisan dusk --filter Tests\Browser\UserTests::userOpenLink

Or by group annotation Eg. Give the following

class UserTests extends TestCase 
{
/**
* @test
* @group user
* @group link
*/
 public function userOpenLink(){...}
/**
* @test
* @group member
* @group link
*/
 public function memberOpenLink(){...}
}
php artisan dusk --group user // Runs first only
php artisan dusk --group member // Runs second only
php artisan dusk --group link  // Runs both tests

Basically, anything you can pass through to PHPUNIT, you can pass through to dusk

7 likes

Please or to participate in this conversation.