Jmeter测试demo
复制代码,保存为.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">20160913003@js.com</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=20160913003@js.com&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 = '20160913003@js.com';</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=20160913003@js.com&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>
Jmeter测试demo的更多相关文章
- jmeter测试dubbo接口
本文讲解jmeter测试dubbo接口的实现方式,文章以一个dubbo的接口为例子进行讲解,该dubbo接口实现的功能为: 一:首先我们看服务端代码 代码架构为: 1:新建一个maven工程,pom文 ...
- 使用Jmeter测试thrift接口
术语描述 jmeter:一款性能压力测试工具,支持多种协议,java .http 等,但是不支持thrift thrift:跨语言的RPC调用框架,提供编译器,可以将thrift接口生成不同语言的接口 ...
- 第三篇 -- IDEA 创建Springboot Web项目并用Jmeter测试
上一节使用Django写的一个接口程序,这一节讲用IDEA配合Springboot创建web项目.一个是python,一个是java. 参考链接:http://www.uxys.com/html/Ja ...
- 用JMeter测试monggodb的请求
JMeter测试MongoDB性能有两种方式,一种是利用JMeter直接测试MongoDB[即通过MongoDB协议测试],另一种是写Java代码方式测试MongoDB[即通过java请求测试] 注: ...
- JMeter学习(十九)JMeter测试MongoDB
JMeter测试MongoDB性能有两种方式,一种是利用JMeter直接进行测试MongoDB,还有一种是写Java代码方式测试MongoDB性能. 第一种方法 1.编写Java代码,内容如下: pa ...
- Jmeter测试webocket协议
Jmeter本身不支持websocket协议的,所以需要安装第三方的插件还有6个依赖包. 首先,我们需要准备Jmeter的WebSocket协议的支持插件: JMeterWebSocketSample ...
- JMeter 测试Web登录
JMeter测试 前置条件: 1安装JMeter 下载地址:http://jmeter.apache.org/ 2安装badBoy http://www.badboy.com.au/download/ ...
- Windows 7下搭建Jmeter测试环境
jmeter配置.安装 一. 工具描述 apache jmeter是100%的java桌面应用程序,它被设计用来加载被测试软件功能特性.度量被测试软件的性能.设计jmeter的初衷是测试web应用,后 ...
- 【jmeter】JMeter测试MongoDB
JMeter测试MongoDB性能有两种方式,一种是利用JMeter直接进行测试MongoDB,还有一种是写Java代码方式测试MongoDB性能. 第一种方法 1.编写Java代码,内容如下: pa ...
随机推荐
- Nginx系列1:ubuntu16.04编译出适合自己的nginx服务器
1.下载nginx nginx官网:nginx.org tar.gz文件 解压缩命令: wget https://nginx.org/download/nginx-1.14.2.tar.gz #下载n ...
- python基础-----字符编码
1.ASCII ASCII(American Standard Code for Information Interchange,美国标准信息交换代码)是基于拉丁字母的一套电脑编码系统,主要用于显示现 ...
- Oracle Instance and Database
- 高效获得Linux函数调用栈/backtrace的方法【转】
转自:https://blog.csdn.net/littlefang/article/details/42295803 有四种方法可以获得Linux的函数调用堆栈,参见CALL STACK TRAC ...
- python下载夏目友人帳
python下载夏目友人帐 一般情况下我们使用爬虫更多的应该是爬数据或者图片吧,今天在这里和大家分享一下关于使用爬虫技术来进行视频下载的方法,不仅可以方便的下载一些体积小的视频,针对大容量的视频下载同 ...
- 华为交换机配置NTP服务端/客户端
作者:邓聪聪 配置设备作为NTP服务器 单播客户端/服务器模式 # 配置NTP主时钟,层数为2. <HUAWEI> system-view [HUAWEI] ntp refclock-ma ...
- Linux中设置别名
作者:邓聪聪 查看别名: alias设置别名: 临时设置: alias show='ls -al' 永久生效: 修改 家目录/.bashrc [root@localhost ~]# cat .bash ...
- centos6.9安装crontab
yum install vixie-cron crontabs //安装 chkconfig crond on //开机自启动 service crond start //启动 然后就是执行 cron ...
- 认证 (authentication) 和授权 (authorization) 的区别
authorization 授权 authentication 身份认证 用户认证流程: 1.用户使用username和password登录 2.系统验证这个password对于该username是正 ...
- ubuntu 远程登录错误
利用 ubuntu 16.04 自带功能远程登录到同事的电脑时,提示如下错误: This file server type is not recognized 百度一下,得知,缺少必要的文件,安装后 ...