Esempio n. 1
0
 /**
  * Run entire test suite of scenarios
  */
 public function run()
 {
     $this->_reportFiles = array();
     $scenarios = $this->_getOptimizedScenarioList();
     foreach ($scenarios as $scenario) {
         /** @var $scenario Magento_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_Performance_Scenario($scenario->getTitle(), $scenario->getFile(), $this->_warmUpArguments + $scenario->getArguments(), $scenario->getSettings(), $scenario->getFixtures());
                 $this->_scenarioHandler->run($scenarioWarmUp);
             } catch (Magento_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_Performance_Scenario_FailureException $scenarioFailure) {
             $this->_notifyScenarioFailure($scenarioFailure);
         }
     }
 }
Esempio n. 2
0
 /**
  * Run scenario and optionally write results to report file
  *
  * @param string $scenarioFile
  * @param Magento_Performance_Scenario_Arguments $scenarioArguments
  * @param string|null $reportFile Report file to write results to, NULL disables report creation
  * @return bool Whether handler was able to process scenario
  */
 public function run($scenarioFile, Magento_Performance_Scenario_Arguments $scenarioArguments, $reportFile = null)
 {
     if (!array_key_exists($scenarioFile, $this->_executedScenarios)) {
         $this->_notifyScenarioFirstRun($scenarioFile);
     }
     try {
         $result = $this->_handler->run($scenarioFile, $scenarioArguments, $reportFile);
         if ($result) {
             $this->_recordScenarioResult($scenarioFile, self::RESULT_SUCCESS);
         }
         return $result;
     } catch (Magento_Performance_Scenario_FailureException $scenarioFailure) {
         $this->_recordScenarioResult($scenarioFile, $scenarioFailure);
         $this->_notifyScenarioFailure($scenarioFile, $scenarioFailure);
         return true;
     }
 }
Esempio n. 3
0
 /**
  * Run entire test suite of scenarios
  *
  * @throws Magento_Exception
  */
 public function run()
 {
     $scenarios = $this->_getOptimizedScenarioList();
     foreach ($scenarios as $scenarioFile) {
         $scenarioArguments = $this->_config->getScenarioArguments($scenarioFile);
         $scenarioSettings = $this->_config->getScenarioSettings($scenarioFile);
         $scenarioFixtures = $this->_config->getScenarioFixtures($scenarioFile);
         $this->_application->applyFixtures($scenarioFixtures);
         /* warm up cache, if any */
         if (empty($scenarioSettings[self::SETTING_SKIP_WARM_UP])) {
             $warmUpArgs = new Magento_Performance_Scenario_Arguments($this->_warmUpArguments + (array) $scenarioArguments);
             $this->_scenarioHandler->run($scenarioFile, $warmUpArgs);
         }
         /* full run with reports recording */
         $scenarioName = preg_replace('/\\..+?$/', '', basename($scenarioFile));
         $reportFile = $this->_config->getReportDir() . DIRECTORY_SEPARATOR . $scenarioName . '.jtl';
         if (!$this->_scenarioHandler->run($scenarioFile, $scenarioArguments, $reportFile)) {
             throw new Magento_Exception("Unable to run scenario '{$scenarioFile}', format is not supported.");
         }
     }
 }