Beispiel #1
0
 /**
  * Records scenario if it is failed.
  *
  * @param AfterScenarioTested $event
  */
 public function collectFailedScenario(AfterScenarioTested $event)
 {
     if (!$this->getFileName()) {
         return;
     }
     if ($event->getTestResult()->getResultCode() !== TestResult::FAILED) {
         return;
     }
     $feature = $event->getFeature();
     $scenario = $event->getScenario();
     $this->lines[] = $feature->getFile() . ':' . $scenario->getLine();
 }
 /**
  * @param AfterScenarioTested $event
  */
 public function onAfterScenarioTested(AfterScenarioTested $event)
 {
     $scenarioPassed = $event->getTestResult()->isPassed();
     if ($scenarioPassed) {
         $this->passedScenarios[] = $this->currentScenario;
         $this->currentFeature->addPassedScenario();
     } else {
         //set screenshot properties
         $this->currentScenario->setScreenshotProperties($this->printer->getOutputPath(), 'assets/screenshots/', $event->getFeature()->getTitle());
         $this->failedScenarios[] = $this->currentScenario;
         $this->currentFeature->addFailedScenario();
     }
     $this->currentScenario->setLoopCount(1);
     $this->currentScenario->setPassed($event->getTestResult()->isPassed());
     $this->currentFeature->addScenario($this->currentScenario);
     $print = $this->renderer->renderAfterScenario($this);
     $this->printer->writeln($print);
 }