栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

每个线程组的概率

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

每个线程组的概率

只需将每个组的线程数设置为测试总数即可。如果100个VU,则将g1设置为50,将g2设置为30,将g3设置为20。

要使其动态,可以使用BeanShell函数,将“线程数”设置为:

${__BeanShell(50*${USERS}/100)}

并将使用包含以下内容的用户定义变量:

USERS : ${__P(USERS, 10)} // for 10 users by default,

然后可以将USERS作为命令行选项传递:

-JUSERS=100

样品:

<?xml version="1.0" encoding="UTF-8"?><jmeterTestPlan version="1.2" properties="2.4" jmeter="2.9-SNAPSHOT.20121216">  <hashTree>    <TestPlan gui test 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" gui test testname="User Defined Variables" enabled="true">        <collectionProp name="Arguments.arguments"/>      </elementProp>      <stringProp name="TestPlan.user_define_classpath"></stringProp>    </TestPlan>    <hashTree>      <Arguments gui test 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 gui test testname="Run50Pct" enabled="true">        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" gui test 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 gui test testname="DS1" enabled="true">          <boolProp name="displayJMeterProperties">false</boolProp>          <boolProp name="displayJMeterVariables">true</boolProp>          <boolProp name="displaySystemProperties">false</boolProp>        </DebugSampler>        <hashTree/>      </hashTree>      <ThreadGroup gui test testname="Run20Pct" enabled="true">        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" gui test 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 gui test testname="DS2" enabled="true">          <boolProp name="displayJMeterProperties">false</boolProp>          <boolProp name="displayJMeterVariables">true</boolProp>          <boolProp name="displaySystemProperties">false</boolProp>        </DebugSampler>        <hashTree/>      </hashTree>      <ThreadGroup gui test testname="Run30Pct" enabled="true">        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" gui test 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 gui test testname="DS3" enabled="true">          <boolProp name="displayJMeterProperties">false</boolProp>          <boolProp name="displayJMeterVariables">true</boolProp>          <boolProp name="displaySystemProperties">false</boolProp>        </DebugSampler>        <hashTree/>      </hashTree>      <ResultCollector gui test testname="View Results Tree" enabled="false">        <boolProp name="ResultCollector.error_logging">false</boolProp>        <objProp>          <name>saveConfig</name>          <value > <time>true</time> <latency>true</latency> <timestamp>true</timestamp> <success>true</success> <label>true</label> <pre>true</pre> <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 gui test testname="Aggregate Report" enabled="true">        <boolProp name="ResultCollector.error_logging">false</boolProp>        <objProp>          <name>saveConfig</name>          <value > <time>true</time> <latency>true</latency> <timestamp>true</timestamp> <success>true</success> <label>true</label> <pre>true</pre> <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>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/385480.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号