I just started using Codeception after years of writing unit tests in plain PHPUnit
. One thing that is bugging me, that I can't find a way to control the order in which the tests are invoked.
In pure old PHPUnit
I was building the test structure manually like this:
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest('MyFirstTest');
$suite->addTest('MySecondTest');
and the test would be invoked in the order which they were added to the suite. Codeception
on the other hand seems to be iterating through directories and running every test it can find.
I would like to be able to control the order of the tests on two levels:
- The order in which different kind of tests are invoked (i.e. I would like to run
unit tests
beforeacceptance tests
) - I would like to control the order of tests invoked in specific test type (in similar manner the
PHPUnit
builds suites)
Ad. 2: Let's say I have two tests in acceptance
directory:
AbcCept.php
WebGuy.php
XyzCept.php
I want to be able to run the XyzCept.php
before AbcCept.php
. Is this even possible?
And to anticipate picky comments: yes, I know that tests should be able to run in any order, and not depend on each other, but that's not what I'm asking.