/** * Build and return scenario execution command and arguments for it * * @param \Magento\TestFramework\Performance\Scenario $scenario * @param string|null $reportFile * @return array */ protected function _buildScenarioCmd(\Magento\TestFramework\Performance\Scenario $scenario, $reportFile = null) { $command = 'jmeter -n -t %s'; $arguments = [$scenario->getFile()]; if ($reportFile) { $command .= ' -l %s'; $arguments[] = $reportFile; } foreach ($scenario->getArguments() as $key => $value) { $command .= ' %s'; $arguments[] = "-J{$key}={$value}"; } return [$command, $arguments]; }
/** * Build and return scenario execution command and arguments for it, compatible with the getopt() "long options" * @link http://www.php.net/getopt * * @param \Magento\TestFramework\Performance\Scenario $scenario * @return array */ protected function _buildScenarioCmd(\Magento\TestFramework\Performance\Scenario $scenario) { $command = 'php -f %s --'; $arguments = [$scenario->getFile()]; foreach ($scenario->getArguments() as $paramName => $paramValue) { $command .= " --{$paramName} %s"; $arguments[] = $paramValue; } return [$command, $arguments]; }
public function testGetArguments() { $expectedArguments = array('arg1' => 'value1', 'arg2' => 'value2', \Magento\TestFramework\Performance\Scenario::ARG_USERS => 1, \Magento\TestFramework\Performance\Scenario::ARG_LOOPS => 1); $this->assertEquals($expectedArguments, $this->_object->getArguments()); }