test123.jmx 12.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="HTTP&#20449;&#24687;&#22836;&#31649;&#29702;&#22120;" enabled="true">
        <collectionProp name="HeaderManager.headers">
          <elementProp name="" elementType="Header">
            <stringProp name="Header.name">a</stringProp>
            <stringProp name="Header.value">1</stringProp>
          </elementProp>
          <elementProp name="" elementType="Header">
            <stringProp name="Header.name">b</stringProp>
            <stringProp name="Header.value">2</stringProp>
          </elementProp>
        </collectionProp>
        <stringProp name="TestPlan.comments">123</stringProp>
      </HeaderManager>
      <hashTree/>
      <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie &#31649;&#29702;&#22120;" enabled="true">
        <collectionProp name="CookieManager.cookies">
          <elementProp name="b" elementType="Cookie" testname="b">
            <stringProp name="Cookie.value">qrwe</stringProp>
            <stringProp name="Cookie.domain">123</stringProp>
            <stringProp name="Cookie.path">/</stringProp>
            <boolProp name="Cookie.secure">false</boolProp>
            <longProp name="Cookie.expires">0</longProp>
            <boolProp name="Cookie.path_specified">true</boolProp>
            <boolProp name="Cookie.domain_specified">true</boolProp>
          </elementProp>
          <elementProp name="1" elementType="Cookie" testname="1">
            <stringProp name="Cookie.value">231</stringProp>
            <stringProp name="Cookie.domain">213</stringProp>
            <stringProp name="Cookie.path">/</stringProp>
            <boolProp name="Cookie.secure">false</boolProp>
            <longProp name="Cookie.expires">0</longProp>
            <boolProp name="Cookie.path_specified">true</boolProp>
            <boolProp name="Cookie.domain_specified">true</boolProp>
          </elementProp>
        </collectionProp>
        <stringProp name="TestPlan.comments">32123123</stringProp>
        <boolProp name="CookieManager.clearEachIteration">false</boolProp>
        <stringProp name="CookieManager.policy">standard</stringProp>
        <stringProp name="CookieManager.implementation">org.apache.jmeter.protocol.http.control.HC4CookieHandler</stringProp>
      </CookieManager>
      <hashTree/>
      <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="&#21464;&#37327;-Hosts" enabled="true">
        <collectionProp name="Arguments.arguments">
          <elementProp name="HOST_API" elementType="Argument">
            <stringProp name="Argument.name">HOST_API</stringProp>
            <stringProp name="Argument.value">api.yoho.cn</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
          <elementProp name="HOST_SERVICE" elementType="Argument">
            <stringProp name="Argument.name">HOST_SERVICE</stringProp>
            <stringProp name="Argument.value">service.yoho.cn</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
        </collectionProp>
        <stringProp name="TestPlan.comments"></stringProp>      </Arguments>
      <hashTree/>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="tg_test_guang" 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">1</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">10</stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <stringProp name="TestPlan.comments"></stringProp>
      </ThreadGroup>
      <hashTree>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_test_guang" 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_SERVICE}/guang/api/v1/share/guang?${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"></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">${__Random(10,20,)} ${__Random(1,10,)}</stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="script">import java.security.MessageDigest;
import java.util.Random;
String[] clientTypes = {&quot;web&quot;,&quot;h5&quot;,&quot;android&quot;,&quot;iphone&quot;};
String[] privateKeys = {&quot;0ed29744ed318fd28d2c07985d3ba633&quot;,&quot;fd4ad5fcfa0de589ef238c0e7331b585&quot;,&quot;fd4ad5fcfa0de589ef238c0e7331b585&quot;,&quot;a85bb0674e08986c6b115d5e3a4884fa&quot;};
int rd = new Random().nextInt(4);
String clientType = clientTypes[rd];
String privateKey = privateKeys[rd];
String req = &quot;app_version=3.8.2&amp;limit=&quot;+bsh.args[0]+&quot;&amp;os_version=9.3.1&amp;page=&quot;+bsh.args[1]+&quot;&amp;private_key=&quot;+private_key+&quot;&amp;screen_size=720x1280&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>600.0</value>
            <savedValue>0.0</savedValue>
          </doubleProp>
          <intProp name="calcMode">2</intProp>
        </ConstantThroughputTimer>
        <hashTree/>
      </hashTree>
      <BackendListener guiclass="BackendListenerGui" testclass="BackendListener" testname="&#19978;&#20256;&#25968;&#25454;&#33267;Influxdb" 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.103.44</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>