Exemplo n.º 1
0
 public function testRunWithScripts()
 {
     $scenarioFile = realpath(__DIR__ . '/_files/scenario_with_scripts.jmx');
     $scriptBefore = realpath(__DIR__ . '/_files/scenario_with_scripts_before.php');
     $scriptAfter = realpath(__DIR__ . '/_files/scenario_with_scripts_after.php');
     $this->_shell->expects($this->at(0))->method('execute')->with('php %s', array($scriptBefore))->will($this->returnValue('fixture output'));
     $this->_shell->expects($this->at(3))->method('execute')->with('php %s --beforeOutput=%s --scenarioExecutions=%s', array($scriptAfter, 'fixture output', 4));
     $this->_object->run($scenarioFile, $this->_scenarioParams);
 }
Exemplo n.º 2
0
 /**
  * @param string $scenarioFile
  * @param array $scenarioParams
  * @param string $expectedExceptionMsg
  * @dataProvider runExceptionDataProvider
  * @expectedException Magento_Exception
  */
 public function testRunException($scenarioFile, array $scenarioParams, $expectedExceptionMsg = '')
 {
     $this->setExpectedException('Magento_Exception', $expectedExceptionMsg);
     $this->_object->run($scenarioFile, $scenarioParams);
 }
Exemplo n.º 3
0
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     performance_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
try {
    /** @var $config Magento_Config */
    $config = (require_once __DIR__ . '/framework/bootstrap.php');
    $adminOptions = $config->getAdminOptions();
    $scenario = new Magento_Scenario(new Magento_Shell(true), $config->getJMeterPath(), $config->getReportDir());
    $scenarioParamsGlobal = array(Magento_Scenario::PARAM_HOST => $config->getApplicationUrlHost(), Magento_Scenario::PARAM_PATH => $config->getApplicationUrlPath(), Magento_Scenario::PARAM_ADMIN_FRONTNAME => $adminOptions['frontname'], Magento_Scenario::PARAM_ADMIN_USERNAME => $adminOptions['username'], Magento_Scenario::PARAM_ADMIN_PASSWORD => $adminOptions['password']);
    $scenarioTotalCount = count($config->getScenarios());
    $scenarioFailCount = 0;
    $scenarioNum = 1;
    foreach ($config->getScenarios() as $scenarioFile => $scenarioParams) {
        echo "Scenario {$scenarioNum} of {$scenarioTotalCount}: '{$scenarioFile}'" . PHP_EOL;
        $scenarioParams = array_merge($scenarioParams, $scenarioParamsGlobal);
        try {
            $scenario->run($scenarioFile, $scenarioParams);
        } catch (Exception $e) {
            echo $e->getMessage() . PHP_EOL;
            $scenarioFailCount++;
        }
        echo PHP_EOL;
        $scenarioNum++;