Skip to content

Instantly share code, notes, and snippets.

Created April 7, 2014 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/10015665 to your computer and use it in GitHub Desktop.
Save anonymous/10015665 to your computer and use it in GitHub Desktop.
Actully I am using php with selenium using PHPUnit_Extensions_Selenium2TestCase class
I have PHPUnit_Extensions_Selenium2TestCase that is extending PHPUnit_Framework_TestCase. Now I added function runBare in this class as per below.
abstract class PHPUnit_Extensions_Selenium2TestCase extends PHPUnit_Framework_TestCase
{
..............................
.............................
public function runBare() {
$retryCount = 2;
for ($i = 0; $i < $retryCount; $i++) {
try {
parent::runBare();
return;
}
catch (Exception $e) {
// last one thrown below
}
}
if ($e) {
throw $e;
}
}
}
But this not runs my failed test cases twice.
What i am missing here ?
Is there any change that i need to do in phpunit test case ?
@dharkness
Copy link

I don't see anything in Selenium2TestCase that should block this from working. Your best bet would be to set some breakpoints and debug the test.

@deepa2083
Copy link

This will not work with a failed test case because the failure exits code before returning back to runBare , hence if the test fails you will not be able to rerun the test . Im still looking to see what is the workaround for it. Any chance you figured that out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment