PHPUnit "no test executed" when I make a coverage report, in Laravel

Viewed 448

I triying to make a report of a coverage of my tests and I cant because when I execute the follow command: phpunit --coverage-html C:\Users\user\report.html I get the follow error:

PHPUnit 3.7.21 by Sebastian Bergmann.

Configuration read from C:\xampp\htdocs\dynamic_form\phpunit.xml


Time: 0 seconds, Memory: 6.00Mb

No tests executed!

Generating code coverage report in HTML format ... done

I using the phpunit.xml that comes by default in Laravel.

What can be the problem?

Thanks

EDIT: I add the forceCoversAnnotation="false" attribute and the problem persits.

1 Answers

In Laravel unit tests are located inside tests folder and they have some rules in naming in order to run them.

I had the same issue in the past and this is how i solved it:

1) Namespace must be Test\Unit (or if you have a middle folder include that but always inside Tests)

2) the name of the function you build must start with the word test like

public function testMyFunction()
{
    // Put your code here
}
Related