blob: bc52858c1d800f0598c1fc7beb9d21032d5594c5 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.5" jmeter="2.10-SNAPSHOT.20130714">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="MongoDB Test Plan" enabled="true">
<stringProp name="TestPlan.comments">Shows how to setup a MongoDB Test</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>
<MongoSourceElement guiclass="TestBeanGUI" testclass="MongoSourceElement" testname="MongoDB Source Config" enabled="true">
<stringProp name="connection">127.0.0.1</stringProp>
<stringProp name="source">db</stringProp>
<boolProp name="autoConnectRetry">false</boolProp>
<intProp name="connectionsPerHost">50</intProp>
<intProp name="connectTimeout">0</intProp>
<longProp name="maxAutoConnectRetryTime">0</longProp>
<intProp name="maxWaitTime">120000</intProp>
<intProp name="socketTimeout">0</intProp>
<boolProp name="socketKeepAlive">false</boolProp>
<intProp name="threadsAllowedToBlockForConnectionMultiplier">5</intProp>
<boolProp name="safe">false</boolProp>
<boolProp name="fsync">false</boolProp>
<boolProp name="waitForJournaling">false</boolProp>
<intProp name="writeOperationNumberOfServers">0</intProp>
<intProp name="writeOperationTimeout">0</intProp>
<boolProp name="continueOnInsertError">false</boolProp>
<stringProp name="TestPlan.comments">Configures connection to MongoDB</stringProp>
</MongoSourceElement>
<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">30</stringProp>
<longProp name="ThreadGroup.start_time">1367357168000</longProp>
<longProp name="ThreadGroup.end_time">1367357168000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration">300</stringProp>
<stringProp name="ThreadGroup.delay">10</stringProp>
</ThreadGroup>
<hashTree>
<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Insert into testCollection" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="parameters"></stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="cacheKey">insert1</stringProp>
<stringProp name="script">import com.mongodb.DB;
import org.apache.jmeter.protocol.mongodb.config.MongoDBHolder;
import com.mongodb.WriteResult;
import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
import com.mongodb.WriteConcern;
import com.mongodb.WriteResult;
// Get DB
com.mongodb.DB db = org.apache.jmeter.protocol.mongodb.config.MongoDBHolder.getDBFromSource(&quot;db&quot;, &quot;test&quot;);
// Get collection to insert
DBCollection coll = db.getCollection(&quot;testCollection&quot;);
BasicDBObject doc = new BasicDBObject(&quot;name&quot;, &quot;MongoDB&quot;).
append(&quot;type&quot;, &quot;database&quot;).
append(&quot;count&quot;, 1).
append(&quot;info&quot;, new BasicDBObject(&quot;x&quot;, 203).append(&quot;y&quot;, 102));
// Insert object
WriteResult wr = coll.insert(doc, WriteConcern.ACKNOWLEDGED);
// Set response data
SampleResult.setResponseData(&quot;&quot;+wr.toString(),&quot;UTF-8&quot;);</stringProp>
</JSR223Sampler>
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="-1358912096">&quot;err&quot; : null</stringProp>
</collectionProp>
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
<intProp name="Assertion.test_type">2</intProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Count from testCollection" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="parameters"></stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="cacheKey">count1</stringProp>
<stringProp name="script">import com.mongodb.DB;
import org.apache.jmeter.protocol.mongodb.config.MongoDBHolder;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.DBCollection;
DB db = MongoDBHolder.getDBFromSource(&quot;db&quot;, &quot;test&quot;);
DBCollection coll = db.getCollection(&quot;testCollection&quot;);
int size = coll.count();
SampleResult.setResponseData(&quot;&quot;+size,&quot;UTF-8&quot;);</stringProp>
</JSR223Sampler>
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="91555">\d+</stringProp>
</collectionProp>
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
<intProp name="Assertion.test_type">1</intProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
</hashTree>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
<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>false</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>false</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>true</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<hostname>true</hostname>
<threadCounts>true</threadCounts>
<sampleCount>true</sampleCount>
</value>
</objProp>
<stringProp name="filename"></stringProp>
<stringProp name="TestPlan.comments">Remove for Load Test</stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" 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>false</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>false</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>true</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<hostname>true</hostname>
<threadCounts>true</threadCounts>
<sampleCount>true</sampleCount>
</value>
</objProp>
<stringProp name="filename"></stringProp>
<stringProp name="TestPlan.comments">Remove for Load Test</stringProp>
</ResultCollector>
<hashTree/>
<Summariser guiclass="SummariserGui" testclass="Summariser" testname="Generate Summary Results" enabled="true"/>
<hashTree/>
</hashTree>
</hashTree>
</jmeterTestPlan>