Reputation: 2768
I wonder :
By folders structure :
tests
|-- functional
|-- unit
By config in phpunit.xml :
<testsuites>
<testsuite name="unit">...</testsuite>
<testsuite name="functional">...</testsuite>
</testsuites>
By annotation
/**
* @group unit
*/
function testMyUnit()
Ii it a reasonable approach? Is there a standard way to do this? What "levels" separate (unit > integration > functional)? And how to take advantage of that if I want to play with these tests manually and fastest, and obtain rational coverage reports in Jenkins?
Upvotes: 9
Views: 1538
Reputation: 1771
You can go for two configuration files - one for functional and one for unit tests. Then you can run your unit tests separately from functional. You want your unit tests to run as quickly as possible or otherwise nobody's gonna run them at development time, so this approach works quite well.
phpunit -c app/phpunit.xml
phpunit -c app/phpunit_functional.xml
The directory structures we used:
src/Namespace/Bundle/Tests/Unit/
src/Namespace/Bundle/Tests/Functional/
The second way is to have one configuration file and run phpunit --testsuite unit
.
Upvotes: 9