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?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With