KarlHill69's avatar

No tests executed

Hello, I want to run a test with the full path, but getting this error. Any suggestion?

I have a phpunit feature test that I want to run, but I cannot see it's running.

vendor/bin/phpunit --filter Feature\FooTest PHPUnit 10.5.30 by Sebastian Bergmann and contributors.

Runtime: PHP 8.3.9

There was 1 PHPUnit test runner deprecation:

No tests executed!

0 likes
3 replies
tisuchi's avatar
tisuchi
Best Answer
Level 70

@karlhill69 If I understand correctly, you want to run a specific test file.

If so, you can do this:

vendor/bin/phpunit Tests/Feature/FooTest.php

Also, make sure that you add annotation /** @test */ before your method or use test_ as the method's prefix.

2 likes
mhdev's avatar

Your syntax isn't quite right. Try this:

vendor/bin/phpunit tests/Feature/FooTest.php

This will run all tests within your FooTest.php file. Alternatively, if you just want to run a single test case within that file, run the following;

vendor/bin/phpunit tests/Feature/FooTest.php --filter=testFoo

2 likes

Please or to participate in this conversation.