jmeter配置DM
时间: 2023-12-27 17:02:54 浏览: 78
以下是jmeter配置DM的步骤:
1. 下载DM8的JDBC驱动包,将其放置在jmeter的lib目录下。
2. 在jmeter中添加一个线程组。
3. 在该线程组下添加JDBC Connection Configuration配置元件,配置DM8数据库的连接信息,包括JDBC驱动类、连接URL、用户名和密码等。
4. 在该线程组下添加JDBC Request配置元件,配置SQL语句和参数等信息。
5. 在该线程组下添加监听器,例如View Results Tree,查看测试结果。
下面是一个示例的jmeter配置DM的脚本:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.9" jmeter="5.4.1">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" 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="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<intProp name="LoopController.loops">1</intProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1630440000000</longProp>
<longProp name="ThreadGroup.end_time">1630440000000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<JDBCConnectionConfiguration guiclass="JDBCConnectionConfigurationGui" testclass="JDBCConnectionConfiguration" testname="JDBC Connection Configuration" enabled="true">
<stringProp name="dataSource">jdbc</stringProp>
<stringProp name="poolMax">5</stringProp>
<stringProp name="timeout">10000</stringProp>
<stringProp name="trimInterval">60000</stringProp>
<stringProp name="autocommit">false</stringProp>
<stringProp name="transactionIsolation">DEFAULT</stringProp>
<stringProp name="keepAlive">true</stringProp>
<stringProp name="preinit">false</stringProp>
<stringProp name="connectionAge">5000</stringProp>
<stringProp name="checkQuery">Select 1</stringProp>
<stringProp name="dbUrl">jdbc:dm://localhost:5236</stringProp>
<stringProp name="driver">dm.jdbc.driver.DmDriver</stringProp>
<stringProp name="username">username</stringProp>
<stringProp name="password">password</stringProp>
</JDBCConnectionConfiguration>
<hashTree/>
<JDBCRequest guiclass="TestBeanGUI" testclass="JDBCRequest" testname="JDBC Request" enabled="true">
<stringProp name="dataSource">jdbc</stringProp>
<stringProp name="queryType">Select Statement</stringProp>
<stringProp name="query">select * from table_name</stringProp>
<stringProp name="queryArguments"></stringProp>
<stringProp name="queryArgumentsTypes"></stringProp>
<stringProp name="variableNames"></stringProp>
<stringProp name="resultVariable"></stringProp>
<stringProp name="resultSetHandler">Store as String</stringProp>
<boolProp name="queryTimeout">false</boolProp>
<stringProp name="queryTimeoutDuration"></stringProp>
<stringProp name="ResultType">Auto</stringProp>
</JDBCRequest>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" 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>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
```
阅读全文