/** * This will create a new threadgroup. Normally called from behat_hooks::before_scenario(). * * @param string $featurename featurename * @param string $threadgroupname threadgroup name. */ public static function start_thread_group($featurename, $threadgroupname) { $size = strtolower(util::get_option('size')); $globalconfig = util::get_feature_config($featurename); $globalconfig = $globalconfig['execution']; // If hard-coded value given (like for warmup) then don't allow modifications for the given value. if (isset($globalconfig['users'][$size])) { $users = '${__P(users,' . $globalconfig['users'][$size] . ')}'; } else { $users = $globalconfig['users']; } if (isset($globalconfig['rampup'][$size])) { $rampup = '${__P(rampup,' . $globalconfig['rampup'][$size] . ')}'; } else { if (isset($globalconfig['rampup'])) { $rampup = $globalconfig['rampup']; } else { $rampup = 5; } } if (isset($globalconfig['loops'][$size])) { $loops = '${__P(loops,' . $globalconfig['loops'][$size] . ')}'; } else { if (isset($globalconfig['loops'])) { $loops = $globalconfig['loops']; } else { $loops = 5; } } $replacements = array('threadgroupname' => $threadgroupname, 'users' => $users, 'rampup' => $rampup, 'loops' => $loops); $threadgroup = self::get_testplan_tag_xml('threadgroup', $replacements); self::replace_append_xml_in_testplan(array(), $threadgroup, '//jmeterTestPlan/hashTree//hashTree'); // Append empty hashTree. self::replace_append_xml_in_testplan(array(), '<hashTree/>', '//jmeterTestPlan/hashTree//hashTree'); }
/** * Method for creating a new HAR file * * @param string $label optional label * * @return string */ public static function new_har($label = '') { $proxyurl = util::get_option('proxyurl'); $proxyport = util::get_option('proxyport'); $data = array("captureContent" => 'true', "initialPageRef" => $label, "captureHeaders" => 'true', "captureBinaryContent" => 'true'); $url = $proxyurl . "/proxy/" . $proxyport . "/har"; $response = self::curl_put($url, $data); return $response; }
/** * After suite event. * * @param SuiteEvent $event * @AfterSuite */ public static function after_suite(SuiteEvent $event) { $browsermobproxy = new browsermobproxyclient(util::get_option('proxyurl')); $browsermobproxy->close_connection(); echo PHP_EOL . "Test plan has been generated under:" . PHP_EOL; echo " - " . util::get_final_testplan_path() . PHP_EOL; }