Stephane Guedon - 2014-11-02

dear all,

this is my situation. I'm using eclipse+makegood(a CI plugin) in order to launch my test. I'm using Zend framework as base of my development. I'm also using PHPUnit_story and with selenium2_testCase.

in 3.7 my test was good and now all my feature tests are Risky.

this is part of my code :

for the story :

/**
 * @scenario
 * @medium
 * 
 */
  public function AffichageStructureDeMenuAccueilEn800x600AvecChrome() {
    $this->given ('AvecLeNavigateur','chrome')
         ->when ('JeMeConnecteALaPage',UrlDuSite."/")
         ->then ('LaZoneDeMenuEstCorrecte',600,800);
 }

the code used for this Given :

/**
 *
 * @see PHPUnit_Extensions_Story_TestCase::runGiven()
 */
public function runGiven(&$world, $action, $arguments) {
    switch ($action) {
        case 'AvecLeNavigateur' : {
            $world['testObject']= new CannevasAccueilTest();
            $world['testObject']->setBrowser($arguments[0]);
        }
        break;
        default : {
            return $this->notImplemented($action);
        }
    }
}

CannevasAccueilTest is an Test extended from PHPUnit_Extensions_Selenium2TestCase

no matter on the When an this is the then :

case 'LaZoneDeMenuEstCorrecte': {
    $result = new PHPUnit_Framework_TestResult;
    $result->stopOnFailure(true); // stop the test at the first failed assertion or the first error
    $world['testObject']->setName('testZoneDeMenu'); // define the test name to launch (same as text function name)
    $world['testObject']->setWindowSize($arguments[0],$arguments[1]);
    $world['testObject']->run($result);
    if (count($result)&&!$result->errorCount()) {
            if ($result->failureCount()) { // an assertion has failed
                $failures = $result->failures();
            $this->fail($failures[0]->getExceptionAsString());
        }
            else { // the test is OK
                $this->assertTrue($result->wasSuccessful()); // story is OK
            }
        }
    else {
        $errors= $result->errors();
        $this->fail("il y a une erreur dans letest".$errors[0]->exceptionMessage());
    }
}

I tried to debug my test and I understood that my trouble occur when the output is controlled ... and it gives me : "Test code or tested code did not (only) close its own output buffers"

does any one can help me understand the new mechanism ?

best regards Fierfeu