2012-12-17 5 views
4

테스트 계획에 3 개의 스레드 그룹이있는 경우 각 그룹에 대해 일정 확률 (요청 가중치)을 어떻게 설정할 수 있습니까? 저는 JMeter의 초심자입니다. 스크린 샷에서 설정을 보여 주시겠습니까?각 스레드 그룹에 대한 확률

+0

스크린 샷을 게시 할 수 있습니까? – Kimi

+0

죄송합니다. 캡쳐 화면을 추가하려고했지만 할 수 없습니다. • 죄송합니다. 스팸 방지 메커니즘으로 새 사용자는 이미지를 게시 할 수 없습니다. 이미지를 게시하려면 10 개 이상의 평판을 얻으십시오. –

+0

무엇의 확률인가? –

답변

2

각 그룹의 스레드 수를 테스트의 총 스레드 수로 설정하면됩니다. 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> 
+0

예, 저는이 방법을 알고 그것을 사용했습니다. 그러나 각 그룹에 대해 확률을 고칠 수있는 방법을 알고 싶습니다. 그러면이 방법이 필요한 경우 공통된 사용자 만 변경할 수 있습니다. –

+0

대답을 –

+0

업데이트했습니다. 나는 각각의 쓰레드 그룹을 열고 각각에 확률을 설정해야한다는 것을 이해했다. 첫째는 $ {__ BeanShell (50 * $ {USERS}/100)}를 써야한다. $ {__ BeanShell (30 * $ {USERS}/100}} $ {__ BeanShell (20 * $ {USERS}/100)}을 써야합니다. 왜 문자열 $ {__ P (USERS, 10)}를 사용해야합니까? 그리고 테스트 계획에서 나는 USERS의 금액을 정의 할 수 있습니까? 또한 "사용자 기본 변수"에? $ {USERS} = 1000 (예) - 맞습니까? –

관련 문제