Skip to content

Commit

Permalink
Improve JMeter Template : Fix Issue 7773 (#7774)
Browse files Browse the repository at this point in the history
* Improve JMeter Template:
In CSV DataSet ignore first line as it contains headers
Share CSV for Thread-Group instead of doing it across all threads
Use scheduler
Add variables definable through properties for:
- Rampup
- Duration
- Threads
Drop HttpClient 3.1 customization
Remove in Test Plan Element host and port as they are defined in User
Variables

* Improve JMeter Template : Fix Issue 7773
This comment #7773
As per request update samples
  • Loading branch information
pmouawad authored and wing328 committed Mar 21, 2018
1 parent 22f0b8d commit d185009
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 195 deletions.
43 changes: 24 additions & 19 deletions modules/swagger-codegen/src/main/resources/JMeter/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@
<boolProp name="TestPlan.functional_mode">false</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 name="host" elementType="Argument">
<stringProp name="Argument.name">host</stringProp>
<stringProp name="Argument.value">localhost</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="port" elementType="Argument">
<stringProp name="Argument.name">port</stringProp>
<stringProp name="Argument.value">8080</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="threads" elementType="Argument">
<stringProp name="Argument.name">threads</stringProp>
<stringProp name="Argument.value">${__P(threads,1)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="rampup" elementType="Argument">
<stringProp name="Argument.name">rampup</stringProp>
<stringProp name="Argument.value">${__P(rampup,1)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="duration" elementType="Argument">
<stringProp name="Argument.name">duration</stringProp>
<stringProp name="Argument.value">${__P(duration,1)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="testCases" elementType="Argument">
<stringProp name="Argument.name">testCases</stringProp>
<stringProp name="Argument.value">${__P(testCases,10)}</stringProp>
Expand Down Expand Up @@ -67,13 +71,13 @@
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">${testCases}</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<stringProp name="ThreadGroup.num_threads">${threads}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${rampup}</stringProp>
<longProp name="ThreadGroup.start_time">1448391617000</longProp>
<longProp name="ThreadGroup.end_time">1448391617000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<stringProp name="ThreadGroup.duration">${duration}</stringProp>
<stringProp name="ThreadGroup.delay">5</stringProp>
</ThreadGroup>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
Expand Down Expand Up @@ -109,7 +113,7 @@
<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.implementation">HttpClient3.1</stringProp>
<stringProp name="HTTPSampler.implementation"></stringProp>
<boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
<stringProp name="TestPlan.comments">{{summary}} {{notes}}</stringProp>
Expand All @@ -121,9 +125,10 @@
<stringProp name="filename">${testData.{{operationId}}File}</stringProp>
<boolProp name="quotedData">true</boolProp>
<boolProp name="recycle">true</boolProp>
<stringProp name="shareMode">shareMode.all</stringProp>
<stringProp name="shareMode">shareMode.group</stringProp>
<boolProp name="stopThread">false</boolProp>
<stringProp name="variableNames"></stringProp>
<boolProp name="ignoreFirstLine">true</boolProp>
</CSVDataSet>
<hashTree/>
</hashTree>
Expand Down
Loading

0 comments on commit d185009

Please sign in to comment.