test.jmx 21.6 KB
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="3.1" jmeter="3.1 r1770033">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="test" enabled="true">
      <stringProp name="TestPlan.comments">YohoPerformanceTest_ThisScriptIsGeneratedByYPT</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="用户定义的变量" enabled="true">
        <collectionProp name="Arguments.arguments">
        </collectionProp>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="header_JmeterTest" enabled="true">
        <collectionProp name="HeaderManager.headers">
          <elementProp name="" elementType="Header">
            <stringProp name="Header.name">User-Agent</stringProp>
            <stringProp name="Header.value">jmeter-test</stringProp>
          </elementProp>
          <elementProp name="" elementType="Header">
            <stringProp name="Header.name">Accept-Encoding</stringProp>
            <stringProp name="Header.value">gzip, deflate</stringProp>
          </elementProp>
        </collectionProp>
        <stringProp name="TestPlan.comments"></stringProp>
      </HeaderManager>
      <hashTree/>
      <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="arguments_SNCP" enabled="true">
        <collectionProp name="Arguments.arguments">
          <elementProp name="SNCP" elementType="Argument">
            <stringProp name="Argument.name">SNCP</stringProp>
            <stringProp name="Argument.value">NGJjYjhkNmwwZGM0OTk0YmQyMTMwZjlmoTZmzjY4cjN</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
        </collectionProp>
        <stringProp name="TestPlan.comments">&#36890;&#29992;session&#26657;&#39564;&#30721;</stringProp>      </Arguments>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_mobile_openid_10w" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/uid_mobile_openid.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">uid,mobile,open_id</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_hosts_pt" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/hosts_pt.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">HOST_API,HOST_SERVICE</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#21830;&#21697;for&#27983;&#35272;" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/product_2w.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">product_id,product_skn</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#21697;&#29260;&#25968;&#25454;" enabled="true">
        <stringProp name="TestPlan.comments">&#21697;&#29260;&#25968;&#25454;</stringProp>
        <stringProp name="filename">/opt/jmeter/data/brand.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">brand_id</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#36141;&#29289;&#36710;&#26597;&#35810;" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/cart_query.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">cart_uid,cart_shopping_key,cart_promotion_id</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#25240;&#25187;&#27963;&#21160;&#25968;&#25454;" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/activity.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">activity_id</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#38480;&#23450;&#21830;&#21697;" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/limitProduct.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">limit_product_code,limit_product_skn,limit_product_sku</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#36891;" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/guang.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">article_id,article_author_id,article_datetime</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#35746;&#21333;" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/order_code.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">order_code,order_uid</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#24215;&#38138;" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/shops.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">shop_id,shop_domain</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_edit_5k" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/uid_cart_edit.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">uid_edit,address_id_edit,shopping_key_edit,coupon_code_1_edit,coupon_code_2_edit</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_submit_5k" enabled="true">
        <stringProp name="TestPlan.comments">&#21487;&#36141;&#20080;&#30340;&#21830;&#21697;</stringProp>
        <stringProp name="filename">/opt/jmeter/data/uid_cart_submit.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">uid_submit,address_id_submit,shopping_key_submit,coupon_code_1_submit,coupon_code_2_submit</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_sku_edit_10" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/sku_edit.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">sku_edit</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_sku_submit_1k" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/sku_submit.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">sku_submit</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_uid_selectAndCart" enabled="true">
        <stringProp name="TestPlan.comments"></stringProp>
        <stringProp name="filename">/opt/jmeter/data/uid_sku_in_cart.csv</stringProp>
        <stringProp name="fileEncoding">utf-8</stringProp>
        <stringProp name="variableNames">uid_selectAndCart,sku_selectAndCart</stringProp>
        <stringProp name="delimiter">,</stringProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
      </CSVDataSet>
      <hashTree/>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_app_limitProduct_hotLimitProduct" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <intProp name="LoopController.loops">-1</intProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">100</stringProp>
        <stringProp name="ThreadGroup.ramp_time">10</stringProp>
        <longProp name="ThreadGroup.start_time">1488865571000</longProp>
        <longProp name="ThreadGroup.end_time">1488865571000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <stringProp name="TestPlan.comments">&#28909;&#38376;&#21457;&#21806;&#21830;&#21697;&#21015;&#34920;&#65288;pageCache&#65292;30&#31186;&#65289;</stringProp>
      </ThreadGroup>
      <hashTree>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_app_limitProduct_hotLimitProduct" enabled="true">
          <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
            <collectionProp name="Arguments.arguments">
              <elementProp name="" elementType="HTTPArgument">
                <boolProp name="HTTPArgument.always_encode">false</boolProp>
                <stringProp name="Argument.value"></stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
            </collectionProp>
          </elementProp>
          <stringProp name="HTTPSampler.domain"></stringProp>
          <stringProp name="HTTPSampler.port"></stringProp>
          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
          <stringProp name="HTTPSampler.response_timeout"></stringProp>
          <stringProp name="HTTPSampler.protocol"></stringProp>
          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
          <stringProp name="HTTPSampler.path">http://${HOST_API}/?${searchValue}</stringProp>
          <stringProp name="HTTPSampler.method">GET</stringProp>
          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
          <boolProp name="HTTPSampler.monitor">false</boolProp>
          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
          <stringProp name="TestPlan.comments">&#28909;&#38376;&#21457;&#21806;&#21830;&#21697;&#21015;&#34920;&#65288;pageCache&#65292;30&#31186;&#65289;</stringProp>
        </HTTPSamplerProxy>
        <hashTree>
          <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="&#21069;&#32622;BeanShell" enabled="true">
            <stringProp name="TestPlan.comments"></stringProp>
            <boolProp name="resetInterpreter">false</boolProp>
            <stringProp name="parameters">${uid}</stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="script">import java.security.MessageDigest;
import java.util.Random;
String[] clientTypes = {&quot;android&quot;};
String[] privateKeys = {&quot;fd4ad5fcfa0de589ef238c0e7331b585&quot;};
int rd = new Random().nextInt(1);
String clientType = clientTypes[rd];
String privateKey = privateKeys[rd];

String req = &quot;app_version=5.8.1&amp;client_type=&quot;+clientType+&quot;&amp;fromPage=iFP_LimitPurchaseHome&amp;limit=20&amp;method=app.limitProduct.hotLimitProduct&amp;os_version=10.3.2&amp;page=1&amp;physical_channel=1&amp;private_key=&quot;+privateKey+&quot;&amp;screen_size=375x667&amp;session_key=328652d299d53f752c280a305f67eb5b&amp;udid=a3ad2e205c3d1cb7f0dcf7f8d8a5174f26f8c56e&amp;uid=&quot;+bsh.args[0]+&quot;&amp;v=7&quot;;
MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);
byte[] btInput = req.getBytes();
md.update(btInput);
byte[] btResult = md.digest();
StringBuffer sb = new StringBuffer();
for(byte b : btResult){
    int bt = b&amp;0xff;
    if(bt&lt;16){
        sb.append(0);
    }
    sb.append(Integer.toHexString(bt));
}
String md5 = sb.toString();


vars.put(&quot;searchValue&quot;,req+&quot;&amp;client_secret=&quot;+md5);</stringProp>
          </BeanShellPreProcessor>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="&#21709;&#24212;&#26029;&#35328;" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="1450572480">&quot;code&quot;:200</stringProp>
            </collectionProp>
            <stringProp name="TestPlan.comments"></stringProp>
            <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
            <boolProp name="Assertion.assume_success">false</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="&#22266;&#23450;TPM" enabled="true">
          <stringProp name="TestPlan.comments"></stringProp>
          <doubleProp>
            <name>throughput</name>
            <value>60000</value>
            <savedValue>0.0</savedValue>
          </doubleProp>
          <intProp name="calcMode">2</intProp>
        </ConstantThroughputTimer>
        <hashTree/>
      </hashTree>
      <BackendListener guiclass="BackendListenerGui" testclass="BackendListener" testname="influxdb_master" enabled="true">
        <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
          <collectionProp name="Arguments.arguments">
            <elementProp name="graphiteMetricsSender" elementType="Argument">
              <stringProp name="Argument.name">graphiteMetricsSender</stringProp>
              <stringProp name="Argument.value">org.apache.jmeter.visualizers.backend.graphite.TextGraphiteMetricsSender</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
            <elementProp name="graphiteHost" elementType="Argument">
              <stringProp name="Argument.name">graphiteHost</stringProp>
              <stringProp name="Argument.value">192.168.104.43</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
            <elementProp name="graphitePort" elementType="Argument">
              <stringProp name="Argument.name">graphitePort</stringProp>
              <stringProp name="Argument.value">2003</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
            <elementProp name="rootMetricsPrefix" elementType="Argument">
              <stringProp name="Argument.name">rootMetricsPrefix</stringProp>
              <stringProp name="Argument.value">${__machineIP()}.</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
            <elementProp name="summaryOnly" elementType="Argument">
              <stringProp name="Argument.name">summaryOnly</stringProp>
              <stringProp name="Argument.value">false</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
            <elementProp name="samplersList" elementType="Argument">
              <stringProp name="Argument.name">samplersList</stringProp>
              <stringProp name="Argument.value">tc_.*</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
            <elementProp name="useRegexpForSamplersList" elementType="Argument">
              <stringProp name="Argument.name">useRegexpForSamplersList</stringProp>
              <stringProp name="Argument.value">true</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
            <elementProp name="percentiles" elementType="Argument">
              <stringProp name="Argument.name">percentiles</stringProp>
              <stringProp name="Argument.value">90</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
          </collectionProp>
        </elementProp>
        <stringProp name="classname">org.apache.jmeter.visualizers.backend.graphite.GraphiteBackendListenerClient</stringProp>
        <stringProp name="TestPlan.comments"></stringProp>
      </BackendListener>
      <hashTree/>    </hashTree>
  </hashTree>
</jmeterTestPlan>