/** * afterFeature * * @param FeatureTested $event */ public function afterFeature(FeatureTested $event) { $this->testsuiteTimer->stop(); $testsuite = $this->currentTestsuite; $testsuite->addAttribute('tests', array_sum($this->testsuiteStats)); $testsuite->addAttribute('failures', $this->testsuiteStats[TestResult::FAILED]); $testsuite->addAttribute('skipped', $this->testsuiteStats[TestResult::SKIPPED]); $testsuite->addAttribute('errors', $this->testsuiteStats[TestResult::PENDING]); $testsuite->addAttribute('time', \round($this->testsuiteTimer->getTime(), 3)); }
/** * afterScenario * * @param mixed $event */ public function afterScenario(AfterScenarioTested $event) { $this->testcaseTimer->stop(); $code = $event->getTestResult()->getResultCode(); $testResultString = array(TestResult::PASSED => 'passed', TestResult::SKIPPED => 'skipped', TestResult::PENDING => 'pending', TestResult::FAILED => 'failed'); $this->testsuiteStats[$code]++; $this->currentTestcase->addAttribute('time', \round($this->testcaseTimer->getTime(), 3)); $this->currentTestcase->addAttribute('status', $testResultString[$code]); if ($this->lastStepFailure) { $failureNode = $this->currentTestcase->addChild('failure', $this->lastStepFailureException->getMessage()); $failureNode->addAttribute('message', $this->lastStepFailure); } }
/** * @param BehatEvent\AfterStepTested $event */ public function onAfterStepTested(BehatEvent\StepTested $event) { $this->timer->stop(); $result = $event->getTestResult(); $step = new Node\Step(); $step->setKeyword($event->getStep()->getKeyword()); $step->setName($event->getStep()->getText()); $step->setLine($event->getStep()->getLine()); $step->setArguments($event->getStep()->getArguments()); $step->setResult($result); $step->setResultCode($result->getResultCode()); $step->setDuration($this->timer->getSeconds()); $this->processStep($step, $result); $this->currentScenario->addStep($step); }
/** * Stops timer. */ public function stopTimer() { $this->timer->stop(); }