-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SPAR-2674 Correctly resolve properties for jmx test options (#1833)
* SPAR-2674 Correctly resolve properties for jmx test options * rename unit test * Fix __P handling * Revert fixes * Revert typo
- Loading branch information
1 parent
304aa90
commit 403f304
Showing
3 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.2"> | ||
<hashTree> | ||
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> | ||
<boolProp name="TestPlan.functional_mode">false</boolProp> | ||
<boolProp name="TestPlan.tearDown_on_shutdown">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> | ||
</TestPlan> | ||
<hashTree> | ||
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="false"> | ||
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> | ||
<stringProp name="LoopController.loops">1</stringProp> | ||
<boolProp name="LoopController.continue_forever">false</boolProp> | ||
</elementProp> | ||
<stringProp name="ThreadGroup.num_threads">1</stringProp> | ||
<stringProp name="ThreadGroup.ramp_time">${rampUp}</stringProp> | ||
<boolProp name="ThreadGroup.delayedStart">false</boolProp> | ||
<boolProp name="ThreadGroup.scheduler">true</boolProp> | ||
<stringProp name="ThreadGroup.duration">${duration}</stringProp> | ||
<stringProp name="ThreadGroup.delay"></stringProp> | ||
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> | ||
</ThreadGroup> | ||
<hashTree> | ||
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false"> | ||
<boolProp name="ResultCollector.error_logging">false</boolProp> | ||
<objProp> | ||
<name>saveConfig</name> | ||
<value class="SampleSaveConfiguration"> | ||
<time>true</time> | ||
<latency>true</latency> | ||
<timestamp>true</timestamp> | ||
<success>true</success> | ||
<label>true</label> | ||
<code>true</code> | ||
<message>true</message> | ||
<threadName>true</threadName> | ||
<dataType>true</dataType> | ||
<encoding>false</encoding> | ||
<assertions>true</assertions> | ||
<subresults>true</subresults> | ||
<responseData>false</responseData> | ||
<samplerData>false</samplerData> | ||
<xml>false</xml> | ||
<fieldNames>true</fieldNames> | ||
<responseHeaders>false</responseHeaders> | ||
<requestHeaders>false</requestHeaders> | ||
<responseDataOnError>false</responseDataOnError> | ||
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> | ||
<assertionsResultsToSave>0</assertionsResultsToSave> | ||
<bytes>true</bytes> | ||
<sentBytes>true</sentBytes> | ||
<url>true</url> | ||
<threadCounts>true</threadCounts> | ||
<idleTime>true</idleTime> | ||
<connectTime>true</connectTime> | ||
</value> | ||
</objProp> | ||
<stringProp name="filename"></stringProp> | ||
</ResultCollector> | ||
<hashTree/> | ||
</hashTree> | ||
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"> | ||
<elementProp name="TestDuration" elementType="Argument"> | ||
<stringProp name="Argument.name">TestDuration</stringProp> | ||
<stringProp name="Argument.value">300</stringProp> | ||
<stringProp name="Argument.metadata">=</stringProp> | ||
</elementProp> | ||
</collectionProp> | ||
</Arguments> | ||
<hashTree/> | ||
<com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup guiclass="com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroupGui" testclass="com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup" testname="bzm - Concurrency Thread Group" enabled="true"> | ||
<elementProp name="ThreadGroup.main_controller" elementType="com.blazemeter.jmeter.control.VirtualUserController"/> | ||
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
<stringProp name="TargetLevel">12</stringProp> | ||
<stringProp name="RampUp">${var1}</stringProp> | ||
<stringProp name="Steps">25</stringProp> | ||
<stringProp name="Hold">${__P(BM_CTG_RampUp,1)}</stringProp> | ||
<stringProp name="LogFilename"></stringProp> | ||
<stringProp name="Iterations"></stringProp> | ||
<stringProp name="Unit">M</stringProp> | ||
<stringProp name="var1">5</stringProp> | ||
</com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup> | ||
<hashTree> | ||
<kg.apc.jmeter.samplers.DummySampler guiclass="kg.apc.jmeter.samplers.DummySamplerGui" testclass="kg.apc.jmeter.samplers.DummySampler" testname="jp@gc - Dummy Sampler" enabled="true"> | ||
<boolProp name="WAITING">true</boolProp> | ||
<boolProp name="SUCCESFULL">true</boolProp> | ||
<stringProp name="RESPONSE_CODE">200</stringProp> | ||
<stringProp name="RESPONSE_MESSAGE">OK</stringProp> | ||
<stringProp name="REQUEST_DATA">Dummy Sampler used to simulate requests and responses | ||
without actual network activity. This helps debugging tests.</stringProp> | ||
<stringProp name="RESPONSE_DATA">Dummy Sampler used to simulate requests and responses | ||
without actual network activity. This helps debugging tests.</stringProp> | ||
<stringProp name="RESPONSE_TIME">${__Random(50,500)}</stringProp> | ||
<stringProp name="LATENCY">${__Random(1,50)}</stringProp> | ||
<stringProp name="CONNECT">${__Random(1,5)}</stringProp> | ||
<stringProp name="URL"></stringProp> | ||
<stringProp name="RESULT_CLASS">org.apache.jmeter.samplers.SampleResult</stringProp> | ||
</kg.apc.jmeter.samplers.DummySampler> | ||
<hashTree/> | ||
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true"> | ||
<boolProp name="ResultCollector.error_logging">false</boolProp> | ||
<objProp> | ||
<name>saveConfig</name> | ||
<value class="SampleSaveConfiguration"> | ||
<time>true</time> | ||
<latency>true</latency> | ||
<timestamp>true</timestamp> | ||
<success>true</success> | ||
<label>true</label> | ||
<code>true</code> | ||
<message>true</message> | ||
<threadName>true</threadName> | ||
<dataType>true</dataType> | ||
<encoding>false</encoding> | ||
<assertions>true</assertions> | ||
<subresults>true</subresults> | ||
<responseData>false</responseData> | ||
<samplerData>false</samplerData> | ||
<xml>false</xml> | ||
<fieldNames>true</fieldNames> | ||
<responseHeaders>false</responseHeaders> | ||
<requestHeaders>false</requestHeaders> | ||
<responseDataOnError>false</responseDataOnError> | ||
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> | ||
<assertionsResultsToSave>0</assertionsResultsToSave> | ||
<bytes>true</bytes> | ||
<sentBytes>true</sentBytes> | ||
<url>true</url> | ||
<threadCounts>true</threadCounts> | ||
<idleTime>true</idleTime> | ||
<connectTime>true</connectTime> | ||
</value> | ||
</objProp> | ||
<stringProp name="filename"></stringProp> | ||
</ResultCollector> | ||
<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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from bzt.jmx import JMX | ||
from bzt.jmx.threadgroups import ThreadGroupHandler | ||
from tests.unit import BZTestCase | ||
|
||
|
||
class TestThreadGroups(BZTestCase): | ||
def test_property_resolving(self): | ||
jmx = JMX(original="tests/resources/jmeter/torero/duration-with-env.jmx") | ||
tgh = ThreadGroupHandler(self.log) | ||
thread_groups = list(tgh.groups(jmx)) | ||
self.assertEqual('${var1}', thread_groups[0].get_ramp_up()) | ||
self.assertEqual('M', thread_groups[0]._get_time_unit()) | ||
self.assertEqual(12, thread_groups[0].get_concurrency()) | ||
self.assertEqual(1, thread_groups[0].get_rate()) | ||
self.assertEqual(None, thread_groups[0].get_iterations()) | ||
self.assertEqual(60, thread_groups[0].get_duration()) | ||
|