Authored by Rong

commit by shell

@@ -38,8 +38,8 @@ @@ -38,8 +38,8 @@
38 <hashTree/> 38 <hashTree/>
39 <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="arguments_TMP" enabled="true"> 39 <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="arguments_TMP" enabled="true">
40 <collectionProp name="Arguments.arguments"> 40 <collectionProp name="Arguments.arguments">
41 - <elementProp name="HOST_TMP" elementType="Argument">  
42 - <stringProp name="Argument.name">HOST_TMP</stringProp> 41 + <elementProp name="HOST_API" elementType="Argument">
  42 + <stringProp name="Argument.name">HOST_API</stringProp>
43 <stringProp name="Argument.value">192.168.104.40:8999</stringProp> 43 <stringProp name="Argument.value">192.168.104.40:8999</stringProp>
44 <stringProp name="Argument.metadata">=</stringProp> 44 <stringProp name="Argument.metadata">=</stringProp>
45 </elementProp> 45 </elementProp>
@@ -58,18 +58,6 @@ @@ -58,18 +58,6 @@
58 <stringProp name="shareMode">shareMode.all</stringProp> 58 <stringProp name="shareMode">shareMode.all</stringProp>
59 </CSVDataSet> 59 </CSVDataSet>
60 <hashTree/> 60 <hashTree/>
61 - <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_hosts_pt" enabled="true">  
62 - <stringProp name="TestPlan.comments"></stringProp>  
63 - <stringProp name="filename">/opt/jmeter/data/hosts_pt.csv</stringProp>  
64 - <stringProp name="fileEncoding">utf-8</stringProp>  
65 - <stringProp name="variableNames">HOST_API,HOST_SERVICE</stringProp>  
66 - <stringProp name="delimiter">,</stringProp>  
67 - <boolProp name="quotedData">false</boolProp>  
68 - <boolProp name="recycle">true</boolProp>  
69 - <boolProp name="stopThread">false</boolProp>  
70 - <stringProp name="shareMode">shareMode.all</stringProp>  
71 - </CSVDataSet>  
72 - <hashTree/>  
73 <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#21830;&#21697;for&#27983;&#35272;" enabled="true"> 61 <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="data_&#21830;&#21697;for&#27983;&#35272;" enabled="true">
74 <stringProp name="TestPlan.comments"></stringProp> 62 <stringProp name="TestPlan.comments"></stringProp>
75 <stringProp name="filename">/opt/jmeter/data/product_2w.csv</stringProp> 63 <stringProp name="filename">/opt/jmeter/data/product_2w.csv</stringProp>
@@ -98,76 +86,6 @@ @@ -98,76 +86,6 @@
98 <stringProp name="TestPlan.comments"></stringProp> 86 <stringProp name="TestPlan.comments"></stringProp>
99 </ThreadGroup> 87 </ThreadGroup>
100 <hashTree> 88 <hashTree>
101 -<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="登录一次" enabled="true"/>  
102 - <hashTree>  
103 - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="pc_first" enabled="true">  
104 - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">  
105 - <collectionProp name="Arguments.arguments"/>  
106 - </elementProp>  
107 - <stringProp name="HTTPSampler.domain"></stringProp>  
108 - <stringProp name="HTTPSampler.port"></stringProp>  
109 - <stringProp name="HTTPSampler.protocol"></stringProp>  
110 - <stringProp name="HTTPSampler.contentEncoding"></stringProp>  
111 - <stringProp name="HTTPSampler.path">http://${HOST_TMP}/signin.html</stringProp>  
112 - <stringProp name="HTTPSampler.method">GET</stringProp>  
113 - <boolProp name="HTTPSampler.follow_redirects">true</boolProp>  
114 - <boolProp name="HTTPSampler.auto_redirects">false</boolProp>  
115 - <boolProp name="HTTPSampler.use_keepalive">true</boolProp>  
116 - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>  
117 - <stringProp name="HTTPSampler.embedded_url_re"></stringProp>  
118 - <stringProp name="HTTPSampler.connect_timeout"></stringProp>  
119 - <stringProp name="HTTPSampler.response_timeout"></stringProp>  
120 - </HTTPSamplerProxy>  
121 - <hashTree>  
122 - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true">  
123 - <collectionProp name="Asserion.test_strings"/>  
124 - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>  
125 - <boolProp name="Assertion.assume_success">false</boolProp>  
126 - <intProp name="Assertion.test_type">16</intProp>  
127 - </ResponseAssertion>  
128 - <hashTree/>  
129 - </hashTree>  
130 - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="pc_login" enabled="true">  
131 - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>  
132 - <elementProp name="HTTPsampler.Arguments" elementType="Arguments">  
133 - <collectionProp name="Arguments.arguments">  
134 - <elementProp name="" elementType="HTTPArgument">  
135 - <boolProp name="HTTPArgument.always_encode">false</boolProp>  
136 - <stringProp name="Argument.value">areaCode=86&amp;account=${mobile_test}&amp;password=abc123&amp;verifyCode=yoho4946abcdef%23%24%25%26!%40&amp;isRemember=true&amp;loginType=password&amp;yohobuy=yoho4946abcdef%23%24%25%26!%40</stringProp>  
137 - <stringProp name="Argument.metadata">=</stringProp>  
138 - </elementProp>  
139 - </collectionProp>  
140 - </elementProp>  
141 - <stringProp name="HTTPSampler.domain"></stringProp>  
142 - <stringProp name="HTTPSampler.port"></stringProp>  
143 - <stringProp name="HTTPSampler.protocol"></stringProp>  
144 - <stringProp name="HTTPSampler.contentEncoding"></stringProp>  
145 - <stringProp name="HTTPSampler.path">http://${HOST_TMP}/passport/login/auth</stringProp>  
146 - <stringProp name="HTTPSampler.method">POST</stringProp>  
147 - <boolProp name="HTTPSampler.follow_redirects">true</boolProp>  
148 - <boolProp name="HTTPSampler.auto_redirects">false</boolProp>  
149 - <boolProp name="HTTPSampler.use_keepalive">true</boolProp>  
150 - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>  
151 - <stringProp name="HTTPSampler.embedded_url_re"></stringProp>  
152 - <stringProp name="HTTPSampler.connect_timeout"></stringProp>  
153 - <stringProp name="HTTPSampler.response_timeout"></stringProp>  
154 - </HTTPSamplerProxy>  
155 - <hashTree>  
156 - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true">  
157 - <collectionProp name="Asserion.test_strings">  
158 - <stringProp name="723337899">&quot;code&quot;:200</stringProp>  
159 - </collectionProp>  
160 - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>  
161 - <boolProp name="Assertion.assume_success">false</boolProp>  
162 - <intProp name="Assertion.test_type">16</intProp>  
163 - </ResponseAssertion>  
164 - <hashTree/>  
165 - </hashTree>  
166 - </hashTree>  
167 - <com.blazemeter.jmeter.controller.ParallelSampler guiclass="com.blazemeter.jmeter.controller.ParallelControllerGui" testclass="com.blazemeter.jmeter.controller.ParallelSampler" testname="bzm - Parallel Controller" enabled="true">  
168 - <boolProp name="PARENT_SAMPLE">false</boolProp>  
169 - </com.blazemeter.jmeter.controller.ParallelSampler>  
170 - <hashTree>  
171 <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_&#20020;&#26102;&#27979;&#35797;" enabled="true"> 89 <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tc_&#20020;&#26102;&#27979;&#35797;" enabled="true">
172 <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> 90 <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
173 <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> 91 <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
@@ -185,7 +103,7 @@ @@ -185,7 +103,7 @@
185 <stringProp name="HTTPSampler.response_timeout"></stringProp> 103 <stringProp name="HTTPSampler.response_timeout"></stringProp>
186 <stringProp name="HTTPSampler.protocol"></stringProp> 104 <stringProp name="HTTPSampler.protocol"></stringProp>
187 <stringProp name="HTTPSampler.contentEncoding"></stringProp> 105 <stringProp name="HTTPSampler.contentEncoding"></stringProp>
188 - <stringProp name="HTTPSampler.path">http://${HOST_TMP}/gateway</stringProp> 106 + <stringProp name="HTTPSampler.path">http://${HOST_API}/gateway?${searchValue}</stringProp>
189 <stringProp name="HTTPSampler.method">GET</stringProp> 107 <stringProp name="HTTPSampler.method">GET</stringProp>
190 <boolProp name="HTTPSampler.follow_redirects">true</boolProp> 108 <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
191 <boolProp name="HTTPSampler.auto_redirects">false</boolProp> 109 <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -196,6 +114,38 @@ @@ -196,6 +114,38 @@
196 <stringProp name="TestPlan.comments"></stringProp> 114 <stringProp name="TestPlan.comments"></stringProp>
197 </HTTPSamplerProxy> 115 </HTTPSamplerProxy>
198 <hashTree> 116 <hashTree>
  117 + <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="&#21069;&#32622;BeanShell" enabled="true">
  118 + <stringProp name="TestPlan.comments"></stringProp>
  119 + <boolProp name="resetInterpreter">false</boolProp>
  120 + <stringProp name="parameters"></stringProp>
  121 + <stringProp name="filename"></stringProp>
  122 + <stringProp name="script">import java.security.MessageDigest;
  123 +import java.util.Random;
  124 +String[] clientTypes = {&quot;android&quot;};
  125 +String[] privateKeys = {&quot;fd4ad5fcfa0de589ef238c0e7331b585&quot;};
  126 +int rd = new Random().nextInt(1);
  127 +String clientType = clientTypes[rd];
  128 +String privateKey = privateKeys[rd];
  129 +
  130 +String req = &quot;a=1&amp;client_type=&quot;+clientType+&quot;&amp;private_key=&quot;+privateKey+&quot;&quot;;
  131 +MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);
  132 +byte[] btInput = req.getBytes();
  133 +md.update(btInput);
  134 +byte[] btResult = md.digest();
  135 +StringBuffer sb = new StringBuffer();
  136 +for(byte b : btResult){
  137 + int bt = b&amp;0xff;
  138 + if(bt&lt;16){
  139 + sb.append(0);
  140 + }
  141 + sb.append(Integer.toHexString(bt));
  142 +}
  143 +String md5 = sb.toString();
  144 +
  145 +
  146 +vars.put(&quot;searchValue&quot;,req+&quot;&amp;client_secret=&quot;+md5);</stringProp>
  147 + </BeanShellPreProcessor>
  148 + <hashTree/>
199 <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="&#21709;&#24212;&#26029;&#35328;" enabled="true"> 149 <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="&#21709;&#24212;&#26029;&#35328;" enabled="true">
200 <collectionProp name="Asserion.test_strings"> 150 <collectionProp name="Asserion.test_strings">
201 <stringProp name="1450572480">Hello world</stringProp> 151 <stringProp name="1450572480">Hello world</stringProp>
@@ -207,7 +157,6 @@ @@ -207,7 +157,6 @@
207 </ResponseAssertion> 157 </ResponseAssertion>
208 <hashTree/> 158 <hashTree/>
209 </hashTree> 159 </hashTree>
210 - </hashTree>  
211 <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="&#22266;&#23450;TPM" enabled="true"> 160 <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="&#22266;&#23450;TPM" enabled="true">
212 <stringProp name="TestPlan.comments"></stringProp> 161 <stringProp name="TestPlan.comments"></stringProp>
213 <doubleProp> 162 <doubleProp>