如果我的測試計劃中有3個線程組,我如何設置每個組的恆定概率(請求權重)? 我是JMeter的新手。您能否在截圖中顯示您的設置?每個線程組的概率
每個線程組的概率
回答
那麼只需將每個組的線程數設置爲測試線程總數的一個因子即可。 如果100個VU,爲g1設置50,爲g2設置爲30,爲g3設置爲20。
爲了使動態,你可以使用BeanShell功能,您將設置線程數來:
${__BeanShell(50*${USERS}/100)}
,並會使用含有User Defined Variables:
USERS : ${__P(USERS, 10)} // for 10 users by default,
然後,用戶可以作爲傳遞命令行選項:
-JUSERS=100
樣本:
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.4" jmeter="2.9-SNAPSHOT.20121216">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<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>
<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="USERS" elementType="Argument">
<stringProp name="Argument.name">USERS</stringProp>
<stringProp name="Argument.value">${__P(USERS, 20)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<stringProp name="Argument.desc">20 is default, to change it on command line -JUSERS=30</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Run50Pct" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__BeanShell(50*${USERS}/100)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1356191395000</longProp>
<longProp name="ThreadGroup.end_time">1356191395000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="DS1" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Run20Pct" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__BeanShell(20*${USERS}/100)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1356191395000</longProp>
<longProp name="ThreadGroup.end_time">1356191395000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="DS2" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Run30Pct" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__BeanShell(30*${USERS}/100)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1356191395000</longProp>
<longProp name="ThreadGroup.end_time">1356191395000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="DS3" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</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>false</message>
<threadName>true</threadName>
<dataType>false</dataType>
<encoding>false</encoding>
<assertions>false</assertions>
<subresults>false</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<hostname>true</hostname>
<threadCounts>true</threadCounts>
<sampleCount>true</sampleCount>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" 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>false</message>
<threadName>true</threadName>
<dataType>false</dataType>
<encoding>false</encoding>
<assertions>false</assertions>
<subresults>false</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<hostname>true</hostname>
<threadCounts>true</threadCounts>
<sampleCount>true</sampleCount>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</jmeterTestPlan>
是的,我知道這種方式並使用它。但我想知道,如果我需要這種方式,我可以如何修復每個組的概率,然後只更改普通用戶數量。 –
我更新了我的答案 –
謝謝!我明白我應該打開每個線程組併爲每個線程組設置概率:對於第一,我應該寫第二個$ {__ BeanShell(50 * $ {USERS}/100)}我應該寫$ {__ BeanShell(30 * $ {USERS}/100)}我應該寫$ {__ BeanShell(20 * $ {USERS}/100)}但爲什麼我們需要使用字符串$ {__ P(USERS,10)}?在測試計劃中,我可以定義USERS的金額?也在「用戶默認變量」? $ {USERS} = 1000(例如) - 它正確嗎? –
- 1. 非線性概率的線性概率
- 2. 每個頂點的概率
- 3. 根據每個值的過去概率計算新概率
- 4. 概率組合
- 5. 檢查線性編程概率。合法
- 6. 概率表面曲線matplotlib
- 7. Matlab中的概率組合
- 8. 數組的概率C++
- 9. Scala中的概率編程
- 10. 組合,概率,骰子
- 11. Javascript加權概率數組
- 12. '正常化'概率數組
- 13. 重新接線晶格的概率0.1
- 14. 線程概念
- 15. 線程概念
- 16. 不尋常的概率(8個皇后概率)
- 17. Random.Next()的概率
- 18. UncaughtExceptionHandler的概率
- 19. 每每個線程
- 20. 概率和頻率
- 21. 計算概率在概率樹
- 22. Weka:如何獲得測試實例的每個類的概率
- 23. 查找每個元素的出現概率在載體
- 24. 我如何設置每個動作的概率?
- 25. 有向圖中每個終端節點的概率
- 26. 如何獲得每個主題的概率槌
- 27. 選擇列表變量給定每個變量的概率
- 28. C#:線程和多線程的概念
- 29. 設計一個概率表
- 30. 多線程和分配數組到c中的每個線程#
你可以發佈你的截圖嗎? – Kimi
對不起,我試過添加屏幕截圖,但是我不能: •很抱歉,作爲垃圾郵件防護機制,新用戶不允許發佈圖片。獲得超過10個聲望來發布圖像。 –
什麼概率? –