复制代码,保存为.jmx文件
需要安装插件:
JMeterPlugins-ExtrasLibs
E:\软件\apache-jmeter-3.0\lib\ext
<?xml version="1.0" encoding="UTF-8"?> <jmeterTestPlan version="1.2" properties="2.9" jmeter="3.0 r1743807"> <hashTree> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Demo" 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="用户定义的变量" enabled="true"> <collectionProp name="Arguments.arguments"> <elementProp name="hosts" elementType="Argument"> <stringProp name="Argument.name">hosts</stringProp> <stringProp name="Argument.value">was.wondershare.com/v1</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="client_sign" elementType="Argument"> <stringProp name="Argument.name">client_sign</stringProp> <stringProp name="Argument.value">A4641BFC-AC51-10DF-6D8B-135FCE898DB0</stringProp> <stringProp name="Argument.desc">false</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="sku" elementType="Argument"> <stringProp name="Argument.name">sku</stringProp> <stringProp name="Argument.value">sku-ween</stringProp> <stringProp name="Argument.desc">false</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="lang" elementType="Argument"> <stringProp name="Argument.name">lang</stringProp> <stringProp name="Argument.value">en-US</stringProp> <stringProp name="Argument.desc">false</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="timestamp" elementType="Argument"> <stringProp name="Argument.name">timestamp</stringProp> <stringProp name="Argument.value">1473732256</stringProp> <stringProp name="Argument.desc">false</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="key" elementType="Argument"> <stringProp name="Argument.name">key</stringProp> <stringProp name="Argument.value">47342D1BEE153385294760BDDB8A7F49</stringProp> <stringProp name="Argument.desc">false</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="email" elementType="Argument"> <stringProp name="Argument.name">email</stringProp> <stringProp name="Argument.value">[email protected]</stringProp> <stringProp name="Argument.desc">false</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="password" elementType="Argument"> <stringProp name="Argument.name">password</stringProp> <stringProp name="Argument.value">123456</stringProp> <stringProp name="Argument.desc">false</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="vc" elementType="Argument"> <stringProp name="Argument.name">vc</stringProp> <stringProp name="Argument.value">vc</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="function_id" elementType="Argument"> <stringProp name="Argument.name">function_id</stringProp> <stringProp name="Argument.value">com.wondershare.drfoneios.fixios</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="tmpStr" elementType="Argument"> <stringProp name="Argument.name">tmpStr</stringProp> <stringProp name="Argument.value">你好!</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="path" elementType="Argument"> <stringProp name="Argument.name">path</stringProp> <stringProp name="Argument.value">C:\Users\Administrator\Desktop\</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="request_token" elementType="Argument"> <stringProp name="Argument.name">request_token</stringProp> <stringProp name="Argument.value">request_token</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> </collectionProp> </elementProp> <stringProp name="TestPlan.user_define_classpath"></stringProp> </TestPlan> <hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="json" enabled="false"> <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> <stringProp name="LoopController.loops">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1473734028000</longProp> <longProp name="ThreadGroup.end_time">1473734028000</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="Debug Sampler" enabled="true"> <boolProp name="displayJMeterProperties">false</boolProp> <boolProp name="displayJMeterVariables">true</boolProp> <boolProp name="displaySystemProperties">false</boolProp> </DebugSampler> <hashTree/> <JDBCDataSource guiclass="TestBeanGUI" testclass="JDBCDataSource" testname="mysql_was_member" enabled="true"> <boolProp name="autocommit">true</boolProp> <stringProp name="checkQuery">Select 1</stringProp> <stringProp name="connectionAge">5000</stringProp> <stringProp name="dataSource">was_member</stringProp> <stringProp name="dbUrl">jdbc:mysql://192.168.10.240:3306/was_member?allowMultiQueries=true</stringProp> <stringProp name="driver">com.mysql.jdbc.Driver</stringProp> <boolProp name="keepAlive">true</boolProp> <stringProp name="password">wscbs123</stringProp> <stringProp name="poolMax">10</stringProp> <stringProp name="timeout">10000</stringProp> <stringProp name="transactionIsolation">DEFAULT</stringProp> <stringProp name="trimInterval">60000</stringProp> <stringProp name="username">ws_cbs_test</stringProp> </JDBCDataSource> <hashTree/> <JDBCDataSource guiclass="TestBeanGUI" testclass="JDBCDataSource" testname="mysql_cbs_cart" enabled="true"> <boolProp name="autocommit">true</boolProp> <stringProp name="checkQuery">Select 1</stringProp> <stringProp name="connectionAge">5000</stringProp> <stringProp name="dataSource">cbs_cart</stringProp> <stringProp name="dbUrl">jdbc:mysql://192.168.10.240:3306/cbs_cart?allowMultiQueries=true</stringProp> <stringProp name="driver">com.mysql.jdbc.Driver</stringProp> <boolProp name="keepAlive">true</boolProp> <stringProp name="password">wscbs123</stringProp> <stringProp name="poolMax">10</stringProp> <stringProp name="timeout">10000</stringProp> <stringProp name="transactionIsolation">DEFAULT</stringProp> <stringProp name="trimInterval">60000</stringProp> <stringProp name="username">ws_cbs_test</stringProp> </JDBCDataSource> <hashTree/> <JDBCSampler guiclass="TestBeanGUI" testclass="JDBCSampler" testname="JDBC Request" enabled="true"> <stringProp name="dataSource">cbs_cart</stringProp> <stringProp name="query">SELECT count(order_id) FROM cart_order WHERE order_num in ('Q160815205759160391628')</stringProp> <stringProp name="queryArguments"></stringProp> <stringProp name="queryArgumentsTypes"></stringProp> <stringProp name="queryTimeout"></stringProp> <stringProp name="queryType">Select Statement</stringProp> <stringProp name="resultSetHandler">Store as String</stringProp> <stringProp name="resultVariable">res</stringProp> <stringProp name="variableNames">c</stringProp> </JDBCSampler> <hashTree> <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="BeanShell断言" enabled="true"> <stringProp name="BeanShellAssertion.query">if(${c_1} != 1) { Failure = true; FailureMessage = "The Values in the Response do not match the expected data."; }</stringProp> <stringProp name="BeanShellAssertion.filename"></stringProp> <stringProp name="BeanShellAssertion.parameters"></stringProp> <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp> </BeanShellAssertion> <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="requestToken" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true"> <collectionProp name="Arguments.arguments"> <elementProp name="method" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">common.request.get</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">method</stringProp> </elementProp> <elementProp name="client_sign" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${client_sign}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">client_sign</stringProp> </elementProp> <elementProp name="sku" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${sku}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">sku</stringProp> </elementProp> <elementProp name="lang" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${lang}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">lang</stringProp> </elementProp> <elementProp name="timestamp" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${timestamp}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">timestamp</stringProp> </elementProp> <elementProp name="key" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${key}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">key</stringProp> </elementProp> <elementProp name="vc" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">c5ac6d4324ff6f1e2f3c9ebb9940f1ff</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">vc</stringProp> </elementProp> </collectionProp> </elementProp> <stringProp name="HTTPSampler.domain">${hosts}</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"></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> </HTTPSamplerProxy> <hashTree> <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="获取返回request_token" enabled="true"> <stringProp name="VAR">request_token</stringProp> <stringProp name="JSONPATH">$.request_token</stringProp> <stringProp name="DEFAULT"></stringProp> <stringProp name="VARIABLE"></stringProp> <stringProp name="SUBJECT">BODY</stringProp> </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> <hashTree/> <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="验证返回request_token" enabled="true"> <stringProp name="BeanShellAssertion.query">if("${request_token}" == "") { Failure = true; FailureMessage = "requestToken is null"; }</stringProp> <stringProp name="BeanShellAssertion.filename"></stringProp> <stringProp name="BeanShellAssertion.parameters"></stringProp> <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp> </BeanShellAssertion> <hashTree/> <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="赋值request_token给全局变量" enabled="true"> <boolProp name="resetInterpreter">false</boolProp> <stringProp name="parameters">${request_token}</stringProp> <stringProp name="filename"></stringProp> <stringProp name="script">${__setProperty(request_token,${request_token_local})};</stringProp> </BeanShellPostProcessor> <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="tmp_member_id" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true"> <collectionProp name="Arguments.arguments"> <elementProp name="method" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">member.info.getTmpMemberId</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">method</stringProp> </elementProp> <elementProp name="client_sign" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${client_sign}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">client_sign</stringProp> </elementProp> <elementProp name="sku" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${sku}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">sku</stringProp> </elementProp> <elementProp name="lang" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${lang}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">lang</stringProp> </elementProp> <elementProp name="timestamp" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${timestamp}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">timestamp</stringProp> </elementProp> <elementProp name="key" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${key}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">key</stringProp> </elementProp> <elementProp name="vc" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">aa55e97abc9f18b8c67dd40a7911a3d3</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">vc</stringProp> </elementProp> </collectionProp> </elementProp> <stringProp name="HTTPSampler.domain">${hosts}</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"></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> </HTTPSamplerProxy> <hashTree> <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="获取返回tmp_member_id" enabled="true"> <stringProp name="VAR">tmp_member_id</stringProp> <stringProp name="JSONPATH">$.tmp_member_id</stringProp> <stringProp name="DEFAULT"></stringProp> <stringProp name="VARIABLE"></stringProp> <stringProp name="SUBJECT">BODY</stringProp> </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> <hashTree/> <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="验证返回tmp_member_id" enabled="true"> <stringProp name="BeanShellAssertion.query">if("${tmp_member_id}" == "") { Failure = true; FailureMessage = "requestToken is null"; }</stringProp> <stringProp name="BeanShellAssertion.filename"></stringProp> <stringProp name="BeanShellAssertion.parameters"></stringProp> <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp> </BeanShellAssertion> <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="register" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true"> <collectionProp name="Arguments.arguments"> <elementProp name="method" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">member.auth.register</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">method</stringProp> </elementProp> <elementProp name="client_sign" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${client_sign}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">client_sign</stringProp> </elementProp> <elementProp name="sku" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${sku}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">sku</stringProp> </elementProp> <elementProp name="lang" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${lang}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">lang</stringProp> </elementProp> <elementProp name="timestamp" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${timestamp}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">timestamp</stringProp> </elementProp> <elementProp name="key" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${key}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">key</stringProp> </elementProp> <elementProp name="email" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${email}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">email</stringProp> </elementProp> <elementProp name="password" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${password}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">password</stringProp> </elementProp> <elementProp name="request_token" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${__property(request_token)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">request_token</stringProp> </elementProp> <elementProp name="tmp_member_id" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${tmp_member_id}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">tmp_member_id</stringProp> </elementProp> <elementProp name="vc" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${vc}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">vc</stringProp> </elementProp> </collectionProp> </elementProp> <stringProp name="HTTPSampler.domain">${hosts}</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"></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> </HTTPSamplerProxy> <hashTree> <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="获取vc" enabled="true"> <stringProp name="filename"></stringProp> <stringProp name="parameters"></stringProp> <boolProp name="resetInterpreter">false</boolProp> <stringProp name="script">import com.JMeter.test.*; String str = "method=member.auth.register&client_sign=${client_sign}&sku=${sku}&lang=${lang}&timestamp=${timestamp}&key=${key}&[email protected]&password=123456&request_token=${__property(request_token)}&tmp_member_id=${tmp_member_id}"; //System.out.println("************************"); //System.out.println(str); //System.out.println("************************"); WasVcGen was = new WasVcGen(); String v = was.VcGen(str); //System.out.println(v); vars.put("vc",v);</stringProp> </BeanShellPreProcessor> <hashTree/> <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="JSON Path Extractor" enabled="true"> <stringProp name="VAR">memberid</stringProp> <stringProp name="JSONPATH">$.member_id</stringProp> <stringProp name="DEFAULT"></stringProp> <stringProp name="VARIABLE"></stringProp> <stringProp name="SUBJECT">BODY</stringProp> </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> <hashTree/> <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="jSON Path Extractor断言" enabled="true"> <stringProp name="BeanShellAssertion.query">//print("${memberid}"); if("${memberid}" == "") { Failure = true; FailureMessage = "member_id is null"; }</stringProp> <stringProp name="BeanShellAssertion.filename"></stringProp> <stringProp name="BeanShellAssertion.parameters"></stringProp> <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp> </BeanShellAssertion> <hashTree/> <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="正则表达式" enabled="true"> <stringProp name="RegexExtractor.useHeaders">false</stringProp> <stringProp name="RegexExtractor.refname">test</stringProp> <stringProp name="RegexExtractor.regex">"member_id":"(.+?)","session_key":"(.+?)"</stringProp> <stringProp name="RegexExtractor.template">$1$,$2$</stringProp> <stringProp name="RegexExtractor.default"></stringProp> <stringProp name="RegexExtractor.match_number">1</stringProp> </RegexExtractor> <hashTree/> <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="正则表达式断言" enabled="true"> <stringProp name="BeanShellAssertion.query">print("***************"); print("${test}"); print("${test_g}"); print("${test_g1}"); print("${test_g2}");</stringProp> <stringProp name="BeanShellAssertion.filename"></stringProp> <stringProp name="BeanShellAssertion.parameters"></stringProp> <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp> </BeanShellAssertion> <hashTree/> <JDBCPostProcessor guiclass="TestBeanGUI" testclass="JDBCPostProcessor" testname="删除注册账号" enabled="true"> <stringProp name="dataSource">was_member</stringProp> <stringProp name="query">DELETE FROM cbs_members WHERE email = '[email protected]';</stringProp> <stringProp name="queryArguments"></stringProp> <stringProp name="queryArgumentsTypes"></stringProp> <stringProp name="queryTimeout"></stringProp> <stringProp name="queryType">Update Statement</stringProp> <stringProp name="resultSetHandler">Store as String</stringProp> <stringProp name="resultVariable"></stringProp> <stringProp name="variableNames"></stringProp> </JDBCPostProcessor> <hashTree/> </hashTree> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true"> <stringProp name="BeanShellSampler.query">//import com.JMeter.test.*; //String str = "method=member.auth.register&client_sign=${client_sign}&sku=${sku}&lang=${lang}&timestamp=${timestamp}&key=${key}&[email protected]&password=123456&request_token=${request_token}&tmp_member_id=${tmp_member_id}"; //System.out.println(str); //System.out.println(str); //WasVcGen was = new WasVcGen(); //String v = was.VcGen(str); //System.out.println(v); //vars.put("vc",v);</stringProp> <stringProp name="BeanShellSampler.filename"></stringProp> <stringProp name="BeanShellSampler.parameters"></stringProp> <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> </BeanShellSampler> <hashTree/> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" 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>true</message> <threadName>true</threadName> <dataType>true</dataType> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responseData>false</responseData> <samplerData>false</samplerData> <xml>false</xml> <fieldNames>true</fieldNames> <responseHeaders>false</responseHeaders> <requestHeaders>false</requestHeaders> <responseDataOnError>false</responseDataOnError> <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> <assertionsResultsToSave>0</assertionsResultsToSave> <bytes>true</bytes> <threadCounts>true</threadCounts> <idleTime>true</idleTime> </value> </objProp> <stringProp name="filename"></stringProp> </ResultCollector> <hashTree/> </hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="json中含数组" enabled="false"> <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> <stringProp name="LoopController.loops">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1474192504000</longProp> <longProp name="ThreadGroup.end_time">1474192504000</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="Debug Sampler" enabled="true"> <boolProp name="displayJMeterProperties">false</boolProp> <boolProp name="displayJMeterVariables">true</boolProp> <boolProp name="displaySystemProperties">false</boolProp> </DebugSampler> <hashTree/> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="list" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true"> <collectionProp name="Arguments.arguments"> <elementProp name="method" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">appfunc.recommend.get</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">method</stringProp> </elementProp> <elementProp name="function_id" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${function_id}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">function_id</stringProp> </elementProp> <elementProp name="client_sign" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${client_sign}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">client_sign</stringProp> </elementProp> <elementProp name="timestamp" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${timestamp}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">timestamp</stringProp> </elementProp> <elementProp name="sku" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${sku}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">sku</stringProp> </elementProp> <elementProp name="lang" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${lang}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">lang</stringProp> </elementProp> <elementProp name="key" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">${key}</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">key</stringProp> </elementProp> <elementProp name="vc" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> <stringProp name="Argument.value">425a4b1b9fabbd564ce89247ba62dbd1</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">vc</stringProp> </elementProp> </collectionProp> </elementProp> <stringProp name="HTTPSampler.domain">${hosts}</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"></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> </HTTPSamplerProxy> <hashTree> <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="获取返回function_idsss" enabled="true"> <stringProp name="VAR">function_idsss</stringProp> <stringProp name="JSONPATH">$.combine[1].function_id</stringProp> <stringProp name="DEFAULT"></stringProp> <stringProp name="VARIABLE"></stringProp> <stringProp name="SUBJECT">BODY</stringProp> </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> <hashTree/> <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="验证返回function_idsss" enabled="true"> <stringProp name="BeanShellAssertion.query">if("${function_idsss}" != "com.wondershare.mobilego.test") { Failure = true; FailureMessage = "requestToken is null"; }</stringProp> <stringProp name="BeanShellAssertion.filename"></stringProp> <stringProp name="BeanShellAssertion.parameters"></stringProp> <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp> </BeanShellAssertion> <hashTree/> </hashTree> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" 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>true</message> <threadName>true</threadName> <dataType>true</dataType> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responseData>false</responseData> <samplerData>false</samplerData> <xml>false</xml> <fieldNames>true</fieldNames> <responseHeaders>false</responseHeaders> <requestHeaders>false</requestHeaders> <responseDataOnError>false</responseDataOnError> <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> <assertionsResultsToSave>0</assertionsResultsToSave> <bytes>true</bytes> <threadCounts>true</threadCounts> <idleTime>true</idleTime> </value> </objProp> <stringProp name="filename"></stringProp> </ResultCollector> <hashTree/> </hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="1、Jmeter参数化之用户变量" enabled="false"> <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> <stringProp name="LoopController.loops">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1448501657000</longProp> <longProp name="ThreadGroup.end_time">1448501657000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true"> <stringProp name="BeanShellSampler.query">print(vars.get("tmpStr"));</stringProp> <stringProp name="BeanShellSampler.filename"></stringProp> <stringProp name="BeanShellSampler.parameters"></stringProp> <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> </BeanShellSampler> <hashTree/> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" 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>true</message> <threadName>true</threadName> <dataType>true</dataType> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responseData>false</responseData> <samplerData>false</samplerData> <xml>false</xml> <fieldNames>false</fieldNames> <responseHeaders>false</responseHeaders> <requestHeaders>false</requestHeaders> <responseDataOnError>false</responseDataOnError> <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> <assertionsResultsToSave>0</assertionsResultsToSave> <bytes>true</bytes> <threadCounts>true</threadCounts> </value> </objProp> <stringProp name="filename"></stringProp> </ResultCollector> <hashTree/> </hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="2、Jmeter参数化之用户动态设置变量" enabled="false"> <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> <stringProp name="LoopController.loops">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1448507024000</longProp> <longProp name="ThreadGroup.end_time">1448507024000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true"> <stringProp name="BeanShellSampler.query">vars.put("tmpStr2","你好,祖国!");//动态注册一个变量tmpStr2 print(vars.get("tmpStr2")); </stringProp> <stringProp name="BeanShellSampler.filename"></stringProp> <stringProp name="BeanShellSampler.parameters"></stringProp> <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> </BeanShellSampler> <hashTree/> </hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="3、Jmeter参数化之函数助手" enabled="false"> <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> <stringProp name="LoopController.loops">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1448507028000</longProp> <longProp name="ThreadGroup.end_time">1448507028000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true"> <stringProp name="BeanShellSampler.query">print(${__Random(10000,99999,)}); print("=============================="); print("${__RandomString(20,abcdefghijklmnopqrstuvwxyz0123456789,)}"); print("=============================="); print("${__time(YYYY/MM/dd HH:mm:ss,)}"); print("=============================="); print("${__UUID}"); print("=============================="); print("${__threadNum}"); print("=============================="); print("id:${__CSVRead(${path}test.dat,0)} name:${__CSVRead(${path}test.dat,1)} no:${__CSVRead(${path}test.dat,2)}"); print("=============================="); print("${_StringFromFile(${path}test.dat,)}");</stringProp> <stringProp name="BeanShellSampler.filename"></stringProp> <stringProp name="BeanShellSampler.parameters"></stringProp> <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> </BeanShellSampler> <hashTree/> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" 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>true</message> <threadName>true</threadName> <dataType>true</dataType> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responseData>false</responseData> <samplerData>false</samplerData> <xml>false</xml> <fieldNames>false</fieldNames> <responseHeaders>false</responseHeaders> <requestHeaders>false</requestHeaders> <responseDataOnError>false</responseDataOnError> <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> <assertionsResultsToSave>0</assertionsResultsToSave> <bytes>true</bytes> <threadCounts>true</threadCounts> </value> </objProp> <stringProp name="filename"></stringProp> </ResultCollector> <hashTree/> </hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="4、Jmeter参数化之CSV配置元件" enabled="false"> <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> <stringProp name="LoopController.loops">10</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1448507032000</longProp> <longProp name="ThreadGroup.end_time">1448507032000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="true"> <stringProp name="delimiter">,</stringProp> <stringProp name="fileEncoding">GBK</stringProp> <stringProp name="filename">test.dat</stringProp> <boolProp name="quotedData">false</boolProp> <boolProp name="recycle">true</boolProp> <stringProp name="shareMode">shareMode.all</stringProp> <boolProp name="stopThread">false</boolProp> <stringProp name="variableNames">id,name,no</stringProp> </CSVDataSet> <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true"> <stringProp name="BeanShellSampler.query">print("-------------------------------------------------------------"); print("ID:" + vars.get("id") + " name:" + vars.get("name") + " no:" + vars.get("no")); </stringProp> <stringProp name="BeanShellSampler.filename"></stringProp> <stringProp name="BeanShellSampler.parameters"></stringProp> <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> </BeanShellSampler> <hashTree/> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" 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>true</message> <threadName>true</threadName> <dataType>true</dataType> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responseData>false</responseData> <samplerData>false</samplerData> <xml>false</xml> <fieldNames>false</fieldNames> <responseHeaders>false</responseHeaders> <requestHeaders>false</requestHeaders> <responseDataOnError>false</responseDataOnError> <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> <assertionsResultsToSave>0</assertionsResultsToSave> <bytes>true</bytes> <threadCounts>true</threadCounts> </value> </objProp> <stringProp name="filename"></stringProp> </ResultCollector> <hashTree/> </hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="5、Jmeter参数化之从数据库读取数据" enabled="false"> <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> <stringProp name="LoopController.loops">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1448507037000</longProp> <longProp name="ThreadGroup.end_time">1448507037000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> <JDBCDataSource guiclass="TestBeanGUI" testclass="JDBCDataSource" testname="JDBC Connection Configuration" enabled="true"> <boolProp name="autocommit">true</boolProp> <stringProp name="checkQuery">Select 1</stringProp> <stringProp name="connectionAge">5000</stringProp> <stringProp name="dataSource">Mysql</stringProp> <stringProp name="dbUrl">jdbc:mysql://192.168.60.99:3306/mobile_loan?generateSimpleParameterMetadata=true&useUnicode=true&characterEncoding=utf8</stringProp> <stringProp name="driver">com.mysql.jdbc.Driver</stringProp> <boolProp name="keepAlive">true</boolProp> <stringProp name="password">123456</stringProp> <stringProp name="poolMax">10</stringProp> <stringProp name="timeout">10000</stringProp> <stringProp name="transactionIsolation">DEFAULT</stringProp> <stringProp name="trimInterval">60000</stringProp> <stringProp name="username">mlopr</stringProp> </JDBCDataSource> <hashTree/> <JDBCSampler guiclass="TestBeanGUI" testclass="JDBCSampler" testname="JDBC Request" enabled="true"> <stringProp name="dataSource">Mysql</stringProp> <stringProp name="query">SELECT CONCAT ("[", GROUP_CONCAT( CONCAT("{baidu_id:'",baidu_id,"',"), CONCAT("user_name:'",user_name,"',"), CONCAT("id_no:'",id_no),"'}"),"]") AS result FROM bd_user;</stringProp> <stringProp name="queryArguments"></stringProp> <stringProp name="queryArgumentsTypes"></stringProp> <stringProp name="queryTimeout"></stringProp> <stringProp name="queryType">Select Statement</stringProp> <stringProp name="resultSetHandler">Store as String</stringProp> <stringProp name="resultVariable"></stringProp> <stringProp name="variableNames"></stringProp> </JDBCSampler> <hashTree/> <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="正则表达式提取器" enabled="true"> <stringProp name="RegexExtractor.useHeaders">false</stringProp> <stringProp name="RegexExtractor.refname">user</stringProp> <stringProp name="RegexExtractor.regex">baidu_id:'(.+?)',user_name:'(.+?)',id_no:'(.+?)'</stringProp> <stringProp name="RegexExtractor.template">$1$$2$$3$</stringProp> <stringProp name="RegexExtractor.default"></stringProp> <stringProp name="RegexExtractor.match_number">-1</stringProp> </RegexExtractor> <hashTree/> <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true"> <stringProp name="BeanShellSampler.query">print("-------------------------------------------------------------"); print("ID:" + vars.get("user_1_g1") + " name:" + vars.get("user_1_g2") + " no:" + vars.get("user_1_g3")); print("ID:" + vars.get("user_2_g1") + " name:" + vars.get("user_2_g2") + " no:" + vars.get("user_2_g3")); print("ID:" + vars.get("user_3_g1") + " name:" + vars.get("user_3_g2") + " no:" + vars.get("user_3_g3")); </stringProp> <stringProp name="BeanShellSampler.filename"></stringProp> <stringProp name="BeanShellSampler.parameters"></stringProp> <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp> </BeanShellSampler> <hashTree/> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" 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>true</message> <threadName>true</threadName> <dataType>true</dataType> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responseData>false</responseData> <samplerData>false</samplerData> <xml>false</xml> <fieldNames>false</fieldNames> <responseHeaders>false</responseHeaders> <requestHeaders>false</requestHeaders> <responseDataOnError>false</responseDataOnError> <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> <assertionsResultsToSave>0</assertionsResultsToSave> <bytes>true</bytes> <threadCounts>true</threadCounts> </value> </objProp> <stringProp name="filename"></stringProp> </ResultCollector> <hashTree/> </hashTree> <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="file" enabled="false"> <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> <stringProp name="LoopController.loops">1</stringProp> </elementProp> <stringProp name="ThreadGroup.num_threads">1</stringProp> <stringProp name="ThreadGroup.ramp_time">1</stringProp> <longProp name="ThreadGroup.start_time">1475142860000</longProp> <longProp name="ThreadGroup.end_time">1475142860000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration"></stringProp> <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="avatar" enabled="true"> <elementProp name="HTTPsampler.Files" elementType="HTTPFileArgs"> <collectionProp name="HTTPFileArgs.files"> <elementProp name="E:\head.jpg" elementType="HTTPFileArg"> <stringProp name="File.path">E:\head.jpg</stringProp> <stringProp name="File.paramname">avatar</stringProp> <stringProp name="File.mimetype">application/octet-stream</stringProp> </elementProp> </collectionProp> </elementProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true"> <collectionProp name="Arguments.arguments"/> </elementProp> <stringProp name="HTTPSampler.domain">${hosts}</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">?method=member.avatar.set&client_sign=${client_sign}&timestamp=${timestamp}&lang=${lang}&sku=${sku}&key=${key}&vc=${vc}&access_token=${__property(access_token)}&member_id=${__property(member_id)}&file_size=36393</stringProp> <stringProp name="HTTPSampler.method">POST</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">true</boolProp> <boolProp name="HTTPSampler.monitor">false</boolProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp> </HTTPSamplerProxy> <hashTree> <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="计算vc" enabled="true"> <stringProp name="filename"></stringProp> <stringProp name="parameters"></stringProp> <boolProp name="resetInterpreter">false</boolProp> <stringProp name="script">import com.JMeter.test.*; String str="method=member.avatar.set&client_sign=${client_sign}&timestamp=${timestamp}&lang=${lang}&sku=${sku}&key=${key}&vc=${vc}&access_token=${__property(access_token)}&member_id=${__property(member_id)}&file_size=36393"; WasVcGen was = new WasVcGen(); String v = was.VcGen(str); vars.put("vc",v);</stringProp> </BeanShellPreProcessor> <hashTree/> <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="获取返回avatar" enabled="true"> <stringProp name="VAR">avatar_local</stringProp> <stringProp name="JSONPATH">$.avatar</stringProp> <stringProp name="DEFAULT"></stringProp> <stringProp name="VARIABLE"></stringProp> <stringProp name="SUBJECT">BODY</stringProp> </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor> <hashTree/> <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="验证返回avatar" enabled="true"> <stringProp name="BeanShellAssertion.query">if("${avatar_local}" == "") { Failure = true; FailureMessage = "avatar is null"; } //print("avatar:${avatar_local}");</stringProp> <stringProp name="BeanShellAssertion.filename"></stringProp> <stringProp name="BeanShellAssertion.parameters"></stringProp> <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp> </BeanShellAssertion> <hashTree/> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" 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>true</message> <threadName>true</threadName> <dataType>true</dataType> <encoding>false</encoding> <assertions>true</assertions> <subresults>true</subresults> <responseData>false</responseData> <samplerData>false</samplerData> <xml>false</xml> <fieldNames>true</fieldNames> <responseHeaders>false</responseHeaders> <requestHeaders>false</requestHeaders> <responseDataOnError>false</responseDataOnError> <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> <assertionsResultsToSave>0</assertionsResultsToSave> <bytes>true</bytes> <threadCounts>true</threadCounts> <idleTime>true</idleTime> </value> </objProp> <stringProp name="filename"></stringProp> </ResultCollector> <hashTree/> </hashTree> </hashTree> </hashTree> </hashTree> </jmeterTestPlan>