protected function runTest()
 {
     parent::runTest();
     try {
         $this->stop();
     } catch (RuntimeException $e) {
     }
 }
예제 #2
0
 /**
  * Run this test's scenario.
  *
  * @return mixed
  * @throws RuntimeException
  */
 protected function runTest()
 {
     $autostop = $this->autoStop;
     $this->autoStop = FALSE;
     try {
         $testResult = parent::runTest();
         $this->scenario->run($this->world);
         $this->autoStop = $autostop;
     } catch (Exception $e) {
         $this->autoStop = $autostop;
         throw $e;
     }
     return $testResult;
 }
예제 #3
0
 /**
  * Run test
  *
  * @return void
  * @access protected
  * @see    ____func_see____
  * @since  1.0.0
  */
 protected function runTest()
 {
     try {
         $shortName = lcfirst(substr($this->getName(), 4));
         if (self::$testsRange && !in_array($shortName, self::$testsRange)) {
             $this->markTestSkipped();
         } elseif ($this->temporarySkipped) {
             $this->markTestSkipped('Temporary skipped - fix test ASAP!');
         } else {
             parent::runTest();
         }
     } catch (\Exception $exception) {
         if (isset($this->drivers[0]) && $this->drivers[0]->getSessionId()) {
             try {
                 $location = preg_replace('/[^\\w]/Ss', '-', $this->getLocation());
                 $location = preg_replace('/-+/Ss', '-', $location);
                 $html = $this->getHtmlSource();
                 $trace = array();
                 if (!defined('DEPLOYMENT_TEST')) {
                     $trace = \XLite\Core\Operator::getInstance()->getBackTrace();
                 }
                 file_put_contents(TESTS_LOG_DIR . 'selenium.' . $location . '.' . date('Ymd-His') . '.html', '<!--' . PHP_EOL . 'Exception: ' . $exception->getMessage() . ';' . PHP_EOL . ($trace ? 'Back trace: ' . var_export($trace, true) . PHP_EOL : '') . '-->' . PHP_EOL . $html);
             } catch (\RuntimeException $e) {
             }
         }
         $backtrace = array();
         foreach ($exception->getTrace() as $t) {
             $b = null;
             if (isset($t['file'])) {
                 $b = $t['file'] . ' : ' . $t['line'];
             } elseif (isset($t['function'])) {
                 $b = 'function ' . $t['function'] . '()';
                 if (isset($t['line'])) {
                     $b .= ' : ' . $t['line'];
                 }
             }
             if ($b) {
                 $backtrace[] = $b;
             }
         }
         file_put_contents(TESTS_LOG_DIR . 'selenium.' . date('Ymd-His') . '.backtrace', 'Exception: ' . $exception->getMessage() . ';' . PHP_EOL . PHP_EOL . 'Backtrace: ' . PHP_EOL . implode(PHP_EOL, $backtrace) . PHP_EOL);
         throw $exception;
     }
 }
예제 #4
0
파일: WebTest.php 프로젝트: studio-v/nano
 protected function runTest()
 {
     $this->autoStop = false;
     try {
         parent::runTest();
     } catch (Exception $e) {
         $this->screenshot(null);
         //			try {
         //				$this->stop();
         //			} catch (RuntimeException $e) {}
         throw $e;
     }
     try {
         $this->stop();
     } catch (RuntimeException $e) {
     }
 }