예제 #1
0
 /**
  * This method is called when a test method did not execute successfully.
  *
  * @param Exception $e
  */
 protected function onNotSuccessfulTest(Exception $e)
 {
     if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
         $buffer = 'Current URL: ' . $this->drivers[0]->getLocation() . "\n";
         if ($this->captureScreenshotOnFailure && !empty($this->screenshotPath) && !empty($this->screenshotUrl)) {
             $filename = $this->getScreenshotPath() . $this->testId . '.png';
             $this->drivers[0]->captureEntirePageScreenshot($filename);
             $buffer .= 'Screenshot: ' . $this->screenshotUrl . '/' . $this->testId . ".png\n";
         }
     }
     $this->stopSession();
     self::$sessionId = NULL;
     if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
         if (is_object($e->getComparisonFailure())) {
             $message = $e->getComparisonFailure()->toString();
         } else {
             $message = $e->getMessage();
         }
         $buffer .= "\n" . $message;
         throw new PHPUnit_Framework_ExpectationFailedException($buffer);
     }
     throw $e;
 }
 private function restoreSessionStateAfterFailedTest()
 {
     self::$sessionId = NULL;
 }
 private function restoreSessionStateAfterFailedTest()
 {
     $this->selectWindow('null');
     self::$sessionId = NULL;
 }