Esempio n. 1
0
 /**
  * Run entire test suite of scenarios
  */
 public function run()
 {
     $this->_reportFiles = [];
     $scenarios = $this->_getOptimizedScenarioList();
     foreach ($scenarios as $scenario) {
         /** @var $scenario \Magento\TestFramework\Performance\Scenario */
         $this->_application->applyFixtures($scenario->getFixtures());
         $this->_notifyScenarioRun($scenario);
         /* warm up cache, if any */
         $settings = $scenario->getSettings();
         if (empty($settings[self::SETTING_SKIP_WARM_UP])) {
             try {
                 $scenarioWarmUp = new \Magento\TestFramework\Performance\Scenario($scenario->getTitle(), $scenario->getFile(), $this->_warmUpArguments + $scenario->getArguments(), $scenario->getSettings(), $scenario->getFixtures());
                 $this->_scenarioHandler->run($scenarioWarmUp);
             } catch (\Magento\TestFramework\Performance\Scenario\FailureException $scenarioFailure) {
                 // do not notify about failed warm up
             }
         }
         /* full run with reports recording */
         $reportFile = $this->_getScenarioReportFile($scenario);
         try {
             $this->_scenarioHandler->run($scenario, $reportFile);
         } catch (\Magento\TestFramework\Performance\Scenario\FailureException $scenarioFailure) {
             $this->_notifyScenarioFailure($scenarioFailure);
         }
     }
 }
Esempio n. 2
0
 /**
  * Scenario run test
  */
 public function testOnScenarioRun()
 {
     $this->_handler->expects($this->any())->method('run');
     $notifications = [];
     $this->_object->onScenarioRun(function ($scenario) use(&$notifications) {
         $notifications[] = $scenario->getFile();
     });
     $this->_object->run();
     $this->assertEquals([realpath($this->_fixtureDir . '/scenario_error.jmx'), realpath($this->_fixtureDir . '/scenario_failure.jmx'), realpath($this->_fixtureDir . '/scenario.jmx')], $notifications);
 }
 public function testRunDelegation()
 {
     $reportFile = 'scenario.jtl';
     $this->_handler->expects($this->once())->method('run')->with($this->_scenario, $reportFile);
     $this->_object->run($this->_scenario, $reportFile);
 }