Created
January 25, 2019 14:51
-
-
Save robingustafsson/1e15ca6f6fd2a79612ea8c485be9eb3e to your computer and use it in GitHub Desktop.
JMeter-to-k6 PR review: Stepping Thread Group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935"> | |
<hashTree> | |
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="jmeter-to-k6-stepping-thread-group" enabled="true"> | |
<stringProp name="TestPlan.comments"></stringProp> | |
<boolProp name="TestPlan.functional_mode">false</boolProp> | |
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> | |
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | |
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | |
<collectionProp name="Arguments.arguments"/> | |
</elementProp> | |
<stringProp name="TestPlan.user_define_classpath"></stringProp> | |
</TestPlan> | |
<hashTree> | |
<kg.apc.jmeter.threads.SteppingThreadGroup guiclass="kg.apc.jmeter.threads.SteppingThreadGroupGui" testclass="kg.apc.jmeter.threads.SteppingThreadGroup" testname="jp@gc - Stepping Thread Group" enabled="true"> | |
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | |
<stringProp name="ThreadGroup.num_threads">100</stringProp> | |
<stringProp name="Threads initial delay">0</stringProp> | |
<stringProp name="Start users count">10</stringProp> | |
<stringProp name="Start users count burst">0</stringProp> | |
<stringProp name="Start users period">30</stringProp> | |
<stringProp name="Stop users count">5</stringProp> | |
<stringProp name="Stop users period">1</stringProp> | |
<stringProp name="flighttime">60</stringProp> | |
<stringProp name="rampUp">5</stringProp> | |
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> | |
<boolProp name="LoopController.continue_forever">false</boolProp> | |
<intProp name="LoopController.loops">-1</intProp> | |
</elementProp> | |
</kg.apc.jmeter.threads.SteppingThreadGroup> | |
<hashTree> | |
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true"> | |
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | |
<collectionProp name="Arguments.arguments"/> | |
</elementProp> | |
<stringProp name="HTTPSampler.domain">test.loadimpact.com</stringProp> | |
<stringProp name="HTTPSampler.port"></stringProp> | |
<stringProp name="HTTPSampler.protocol"></stringProp> | |
<stringProp name="HTTPSampler.contentEncoding"></stringProp> | |
<stringProp name="HTTPSampler.path"></stringProp> | |
<stringProp name="HTTPSampler.method">GET</stringProp> | |
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> | |
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> | |
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> | |
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | |
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> | |
<stringProp name="HTTPSampler.connect_timeout"></stringProp> | |
<stringProp name="HTTPSampler.response_timeout"></stringProp> | |
</HTTPSamplerProxy> | |
<hashTree/> | |
<ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true"> | |
<stringProp name="ConstantTimer.delay">1000</stringProp> | |
</ConstantTimer> | |
<hashTree/> | |
</hashTree> | |
</hashTree> | |
</hashTree> | |
</jmeterTestPlan> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from "k6/http" | |
import k6 from "k6" | |
const vus = 100 | |
let url, opts, auth, r, regex, match, matches, extract, output | |
let csvPage = {}, csvColumns = {} | |
const constants = {} | |
const vars = {} | |
const files = {} | |
export let options = { | |
stages: [{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"},{"target":10,"duration":"30ms"}] | |
} | |
export default function (data) { | |
if (__VU >= 1 && __VU <= 100) { | |
url = `${`http`}://${`test.loadimpact.com`}` | |
opts = { | |
redirects: 999 | |
} | |
r = http.request(`GET`, url, '', opts) | |
k6.sleep(1) | |
} else throw new Error('Unexpected VU: ' + __VU) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment