phpunit-selenium
phpunit-selenium copied to clipboard
PHPUnit_Extensions_Selenium2TestCase ordering tests by @depends is a little faulty
Hi,
The @depends annotation is working fine on 'PHPUnit_Extensions_Selenium2TestCase' PHPUnit 4.1.3. However, the ordering seems to behave differently.
For example if my class is arranged like below, PHPUnit skips the first two tests.
/**
* @depends testOne
*/
public function testTwo() {
....
}
/**
* @depends testOne
*/
public function testThree() {
....
}
public function testOne() {
....
}
But if I rearrange my methods like below, the test is executed as expected.
public function testOne() {
....
}
/**
* @depends testOne
*/
public function testTwo() {
....
}
/**
* @depends testOne
*/
public function testThree() {
....
}
Now, my question is... is PHPUnit using the @depends method for rearranging the tests in a particular order or it only cares if the testOne() method has passed/executed before executing testTwo() and testThree()?
Edit:
I understand that in Unit Testing, running tests in a particular order is frowned upon by the forefathers. But when it comes to Functional testing using Selenium, etc... in most cases you are not only testing the functionality but also the workflow as well. So, it might be required to run the tests in a particular order and not bloat a single method with your particular workflow.
Also, you will notice that my methods are ordered alphabetically on the initial attempt. So, when PHPUnit forces you to write the methods you want to execute them in order... it ruins the poetry side of coding.
Where is the difference if PHPUnit executes the methods in the order you write them vs PHPUnit automatically rearranging all the methods if the @depends annotation is present?
I agree @depends seems useful for functional tests. But is this a PHPUnit_Selenium issue, like we are doing the reordering, or is it in general a regression of PHPUnit 4.x?