Example #1
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.
 *
 * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
/** @var $config \Magento\TestFramework\Performance\Config */
$config = (require_once __DIR__ . '/framework/bootstrap.php');
$logWriter = new \Zend_Log_Writer_Stream('php://output');
$logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
$logger = new \Zend_Log($logWriter);
$shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer(), $logger);
$scenarioHandler = new \Magento\TestFramework\Performance\Scenario\Handler\FileFormat();
$scenarioHandler->register('jmx', new \Magento\TestFramework\Performance\Scenario\Handler\Jmeter($shell))->register('php', new \Magento\TestFramework\Performance\Scenario\Handler\Php($shell));
$testsuite = new \Magento\TestFramework\Performance\Testsuite($config, new \Magento\TestFramework\Application($config, $shell), $scenarioHandler);
$scenarioTotalCount = count($config->getScenarios());
$scenarioCount = 1;
$scenarioFailCount = 0;
$testsuite->onScenarioRun(function (\Magento\TestFramework\Performance\Scenario $scenario) use($logger, &$scenarioCount, $scenarioTotalCount) {
    $logger->log("Scenario {$scenarioCount} of {$scenarioTotalCount}: '{$scenario->getTitle()}'", \Zend_Log::INFO);
    $scenarioCount++;
});
$testsuite->onScenarioFailure(function (\Magento\TestFramework\Performance\Scenario\FailureException $scenarioFailure) use($logger, &$scenarioFailCount) {
    $scenario = $scenarioFailure->getScenario();
    $logger->log("Scenario '{$scenario->getTitle()}' has failed!", \Zend_Log::ERR);
    $logger->log($scenarioFailure->getMessage(), \Zend_Log::ERR);
    $scenarioFailCount++;
});
 * 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.
 *
 * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
/** @var $bootstrap \Magento\TestFramework\Performance\Bootstrap */
$bootstrap = (require_once __DIR__ . '/framework/bootstrap.php');
$logWriter = new \Zend_Log_Writer_Stream('php://output');
$logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
$logger = new \Zend_Log($logWriter);
$shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer(), $logger);
$scenarioHandler = new \Magento\TestFramework\Performance\Scenario\Handler\FileFormat();
$scenarioHandler->register('jmx', new \Magento\TestFramework\Performance\Scenario\Handler\Jmeter($shell))->register('php', new \Magento\TestFramework\Performance\Scenario\Handler\Php($shell));
$application = $bootstrap->createApplication($shell);
$testsuite = $bootstrap->createTestSuite($application, $scenarioHandler);
$scenarioTotalCount = count($bootstrap->getConfig()->getScenarios());
$scenarioCount = 1;
$scenarioFailCount = 0;
$testsuite->onScenarioRun(function (\Magento\TestFramework\Performance\Scenario $scenario) use($logger, &$scenarioCount, $scenarioTotalCount) {
    $logger->log("Scenario {$scenarioCount} of {$scenarioTotalCount}: '{$scenario->getTitle()}'", \Zend_Log::INFO);
    $scenarioCount++;
});
$testsuite->onScenarioFailure(function (\Magento\TestFramework\Performance\Scenario\FailureException $scenarioFailure) use($logger, &$scenarioFailCount) {
    $scenario = $scenarioFailure->getScenario();
    $logger->log("Scenario '{$scenario->getTitle()}' has failed!", \Zend_Log::ERR);
    $logger->log($scenarioFailure->getMessage(), \Zend_Log::ERR);
    $scenarioFailCount++;