Beispiel #1
0
 /**
  * Ensure reports directory exists, empty, and has write permissions
  *
  * @throws Magento_Exception
  */
 public function cleanupReports()
 {
     $reportDir = $this->_config->getReportDir();
     if (file_exists($reportDir) && !Varien_Io_File::rmdirRecursive($reportDir)) {
         throw new Magento_Exception("Cannot cleanup reports directory '{$reportDir}'.");
     }
     mkdir($reportDir, 0777, true);
 }
Beispiel #2
0
 /**
  * Returns unique report file for the scenario.
  * Used in order to generate unique report file paths for different scenarios that are represented by same files.
  *
  * @param Magento_Performance_Scenario $scenario
  * @return string
  */
 protected function _getScenarioReportFile(Magento_Performance_Scenario $scenario)
 {
     $basePath = $this->_config->getReportDir() . DIRECTORY_SEPARATOR . pathinfo($scenario->getFile(), PATHINFO_FILENAME);
     $iteration = 1;
     do {
         $suffix = $iteration == 1 ? '' : '_' . $iteration;
         $reportFile = $basePath . $suffix . '.jtl';
         $iteration++;
     } while (isset($this->_reportFiles[$reportFile]));
     $this->_reportFiles[$reportFile] = true;
     return $reportFile;
 }
Beispiel #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.");
         }
     }
 }
Beispiel #4
0
 public function testGetReportDir()
 {
     $expectedReportDir = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'report';
     $this->assertEquals($expectedReportDir, $this->_object->getReportDir());
 }