function let(DrupalDriverManager $drupal, ScenarioTested $event, FeatureNode $feature, ScenarioNode $scenario, Suite $suite, Environment $environment) { $parameters = array('default_driver' => 'blackbox', 'api_driver' => 'drupal_driver'); $this->beConstructedWith($drupal, $parameters); $event->getFeature()->willReturn($feature); $event->getScenario()->willReturn($scenario); $event->getEnvironment()->willReturn($environment); $feature->getTags()->willReturn(array('api')); $feature->hasTag('api')->willReturn(TRUE); $scenario->getTags()->willReturn(array()); }
function let(Mink $mink, ScenarioTested $event, FeatureNode $feature, ScenarioNode $scenario, Suite $suite) { $this->beConstructedWith($mink, 'goutte', 'selenium2', array('selenium2', 'sahi')); $event->getSuite()->willReturn($suite); $event->getFeature()->willReturn($feature); $event->getScenario()->willReturn($scenario); $suite->hasSetting('mink_session')->willReturn(false); $suite->getName()->willReturn('default'); $feature->hasTag('insulated')->willReturn(false); $feature->getTags()->willReturn(array()); $scenario->hasTag('insulated')->willReturn(false); $scenario->getTags()->willReturn(array()); }
private function configureVCR(Configuration $configuration, ScenarioTested $event) { $currentVcrConfiguration = $this->videorecorder->configure(); if ($configuration->getCassettePath()) { $currentVcrConfiguration->setCassettePath($configuration->getCassettePath()); } if ($configuration->getCassetteStorage()) { $currentVcrConfiguration->setStorage($configuration->getCassetteStorage()); } if ($configuration->getLibraryHooks()) { $currentVcrConfiguration->enableLibraryHooks($configuration->getLibraryHooks()); } if ($configuration->getRequestMatchers()) { $currentVcrConfiguration->enableRequestMatchers($configuration->getRequestMatchers()); } if ($configuration->getMode()) { $currentVcrConfiguration->setMode($configuration->getMode()); } $filename = $configuration->getFileNamingStrategy()->createFilename($event->getFeature(), $event->getScenario(), $this->outline); $this->videorecorder->insertCassette($filename); }
/** * beforeExample * * @param ScenarioTested $event * * @return void */ public function beforeExample(ScenarioTested $event) { $this->currentTestcase = $this->currentTestsuite->addChild('testcase'); $this->currentTestcase->addAttribute('name', $this->currentOutlineTitle . ' Line #' . $event->getScenario()->getLine()); $this->testcaseTimer->start(); }
/** * Captures scenario tested event. * * @param ScenarioTested $event */ private function captureScenarioEvent(ScenarioTested $event) { if ($event instanceof AfterScenarioTested) { $this->afterScenarioTestedEvents[$event->getScenario()->getLine()] = array('event' => $event, 'step_events' => $this->afterStepTestedEvents, 'step_setup_events' => $this->afterStepSetupEvents); $this->afterStepTestedEvents = array(); $this->afterStepSetupEvents = array(); } }
/** * Before Scenario/Outline Example hook * * @param \Behat\Behat\EventDispatcher\Event\ScenarioTested $event */ public function beforeScenario(ScenarioTested $event) { $node = $event->getScenario(); $id = $event->getFeature()->getFile() . ':' . $node->getLine(); $this->coverage->start($id); }
public function showStepResponse(ScenarioTested $event) { // get scenario id foreach ($this->testcases as $key => $value) { if ($value == $event->getScenario()->getTitle()) { TestRailApiWrapper::log_testcase_result($key, $this->resolvResult($event->getTestResult()), "description"); } } print $event->getScenario()->getTitle(); $testResult = $event->getTestResult(); if (!$testResult instanceof ExceptionResult) { return; } }
/** * beforeExample * * @param ScenarioTested $event * * @return void */ public function beforeExample(ScenarioTested $event) { $this->currentTestcase = $this->currentTestsuite->addChild('testcase'); $scenario = $event->getScenario(); $tokens = array_change_key_case($scenario->getTokens()); $test_case_name = $this->currentOutlineTitle; if (array_key_exists('description', $tokens)) { $scenario_description = $tokens['description']; $test_case_name .= ' - ' . $scenario_description; } else { $test_case_name .= ' Line #' . $event->getScenario()->getLine(); } $this->currentTestcase->addAttribute('name', $test_case_name); $this->testcaseTimer->start(); }