Note that there are some explanatory texts on larger screens.

plurals
  1. POPHPUnit best practices to organize tests
    primarykey
    data
    text
    <p>I am currently going to start from scratch with the phpunit tests for a project. So I was looking into some projects (like Zend) to see how they are doing things and how they organizing their tests.</p> <p>Most things are pretty clear, only thing I have some problems with is how to organize the test suites properly. Zend has an AllTests.php from which loads others test suites.<br> Tough looking at the class it is useing <code>PHPUnit_Framework_TestSuite</code> to create a suite object and then add the other suites to it, but if I look in the PHPUnit docs for organizing tests in PHPUnit versions after 3.4 there is only a description for XML or FileHierarchy. The one using classes to organize the tests was removed.<br> I haven't found anything that this method is deprecated and projects like Zend are still using it.</p> <p>But if it is deprecated, how would I be able to organize tests in the same structure with the xml configuration? Executing all tests is no problem, but how would I organize the tests (in the xml) if I only wanted to execute a few tests. Maybe creating several xmls where I only specify a few tests/test suites to be run? </p> <p>So if I would want to only test module1 and module2 of the application, would I have an extra xml for each and defining test suites only for those modules (classes used by the module) in it. And also one that defines a test suite for all tests? </p> <p>Or would it be better to use the <code>@group</code> annotation on the specific tests to mark them to be for module1 or module2? </p> <p>Thanks in advance for pointing me to some best practices.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload