public function testGetScenarios() { $dir = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; $expectedScenarios = array($dir . 'scenario.jmx', $dir . 'scenario_error.jmx', $dir . 'scenario_failure.jmx'); $actualScenarios = $this->_object->getScenarios(); sort($actualScenarios); $this->assertEquals($expectedScenarios, $actualScenarios); }
/** * Compose optimal list of scenarios, so that Magento reinstalls will be reduced among scenario executions * * @return array */ protected function _getOptimizedScenarioList() { $optimizer = new Magento_Performance_Testsuite_Optimizer(); $scenarios = array(); foreach ($this->_config->getScenarios() as $scenarioFile) { $scenarios[$scenarioFile] = $this->_config->getScenarioFixtures($scenarioFile); } return $optimizer->run($scenarios); }
/** * Compose optimal order of scenarios, so that Magento reinstalls will be reduced among scenario executions * * @return array */ protected function _getOptimizedScenarioList() { $optimizer = new Magento_Performance_Testsuite_Optimizer(); $scenarios = $this->_config->getScenarios(); $fixtureSets = array(); foreach ($scenarios as $scenario) { /** @var $scenario Magento_Performance_Scenario */ $fixtureSets[] = $scenario->getFixtures(); } $keys = $optimizer->optimizeFixtureSets($fixtureSets); $result = array(); foreach ($keys as $key) { $result[] = $scenarios[$key]; } return $result; }
public function testGetScenarios() { $actualScenarios = $this->_object->getScenarios(); // Assert array of scenarios is correctly composed $this->assertInternalType('array', $actualScenarios); $this->assertCount(3, $actualScenarios); // Assert that the data is passed to scenarios successfully /** @var $scenario Magento_Performance_Scenario */ $scenario = $actualScenarios[0]; $this->assertInstanceOf('Magento_Performance_Scenario', $scenario); $this->assertEquals('Scenario', $scenario->getTitle()); $this->assertEquals(realpath(__DIR__ . '/_files/scenario.jmx'), $scenario->getFile()); // Assert that default config is applied $expectedArguments = array(Magento_Performance_Scenario::ARG_USERS => 1, Magento_Performance_Scenario::ARG_LOOPS => 1, Magento_Performance_Scenario::ARG_HOST => '127.0.0.1', Magento_Performance_Scenario::ARG_PATH => '/', Magento_Performance_Scenario::ARG_ADMIN_FRONTNAME => 'backend', Magento_Performance_Scenario::ARG_ADMIN_USERNAME => 'admin', Magento_Performance_Scenario::ARG_ADMIN_PASSWORD => 'password1', Magento_Performance_Scenario::ARG_BASEDIR => $this->_getFixtureAppBaseDir(), 'arg1' => 'value 1', 'arg2' => 'overridden value 2', 'arg3' => 'custom value 3'); $this->assertEquals($expectedArguments, $scenario->getArguments()); $expectedSettings = array('setting1' => 'setting 1', 'setting2' => 'overridden setting 2', 'setting3' => 'setting 3'); $this->assertEquals($expectedSettings, $scenario->getSettings()); $expectedSettings = array('setting1' => 'setting 1', 'setting2' => 'overridden setting 2', 'setting3' => 'setting 3'); $this->assertEquals($expectedSettings, $scenario->getSettings()); $expectedFixtures = array(realpath(__DIR__ . '/_files/fixture.php'), realpath(__DIR__ . '/_files/fixture2.php')); $this->assertEquals($expectedFixtures, $scenario->getFixtures()); }