Beispiel #1
0
 public function runStep(Step $step)
 {
     $this->steps[] = $step;
     $result = null;
     $this->metadata->getService('dispatcher')->dispatch(Events::STEP_BEFORE, new StepEvent($this->test, $step));
     try {
         $result = $step->run($this->metadata->getService('modules'));
     } catch (ConditionalAssertionFailed $f) {
         $result = $this->test->getTestResultObject();
         $result->addFailure(clone $this->test, $f, $result->time());
     } catch (\Exception $e) {
         $this->metadata->getService('dispatcher')->dispatch(Events::STEP_AFTER, new StepEvent($this->test, $step));
         throw $e;
     }
     $this->metadata->getService('dispatcher')->dispatch(Events::STEP_AFTER, new StepEvent($this->test, $step));
     $step->executed = true;
     return $result;
 }
 protected function isExecutedInCurrentEnvironment(TestInterface $test)
 {
     $envs = $test->getMetadata()->getEnv();
     if (empty($envs)) {
         return true;
     }
     $currentEnvironments = explode(',', $this->env);
     foreach ($envs as $envList) {
         $envList = explode(',', $envList);
         if (count($envList) == count(array_intersect($currentEnvironments, $envList))) {
             return true;
         }
     }
     return false;
 }
 public function _before(\Codeception\TestInterface $test)
 {
     $this->scenario = $test->getScenario();
 }
 public function _before(\Codeception\TestInterface $test)
 {
     $this->feature = $test->getMetadata()->getFeature();
 }
 public function _before(TestInterface $test)
 {
     if (!isset($this->webDriver)) {
         $this->_initialize();
     }
     $test->getMetadata()->setCurrent(['browser' => $this->config['browser'], 'capabilities' => $this->config['capabilities']]);
 }
Beispiel #6
0
 /**
  * @param mixed  $exceptionName
  * @param string $exceptionMessage
  * @param int    $exceptionCode
  */
 public function setExpectedException($exceptionName, $exceptionMessage = '', $exceptionCode = null)
 {
     $this->test->setExpectedException($exceptionName, $exceptionMessage, $exceptionCode);
 }