jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Is it possible to restrict the CSV Data config element to a specific Sampler or even Logic Controller?
Date Wed, 15 Aug 2012 15:52:33 GMT
Hi
I dont remember the scoping rules now (but I believe the  CSV config had to
be a child of a while controller or equivalent to do what you want - but my
memory has always been poor :) )

In any case it looks like the csvread or stringfromfile functions would
work for you
http://jmeter.apache.org/usermanual/functions.html

P.S. if you attached your test script it didnt come to the mailing list -
you should upload the script and provide a link to it.
regards
deepak

On Wed, Aug 15, 2012 at 12:03 AM, Jean FX <xor007@gmail.com> wrote:

> Hello Shaba.
>
> I had tried putting the CSV Data config element in both a Logic Controller
> and a Sampler. In both case jMeter did not respect this. It repeated
> execution for every line in the csv file even beyond the Logic
> Controller(see my test plan bellow).
>
> Your site does not address this topic.
>
> On Tue, Aug 14, 2012 at 3:17 PM, Shaba K <shabazia09@gmail.com> wrote:
>
> > Yes we can include CSV data config as a child to that sampler.
> >
> > Here's a little write up about JMeter hope it helps.
> >
> > http://automationwithselenium.blogspot.co.uk/2012/01/jmeter-proxy.html
> >
> > cheers,
> > s
> >
> > On Tue, Aug 14, 2012 at 12:50 PM, Jean FX <xor007@gmail.com> wrote:
> >
> > > Hello,
> > >
> > > I am a really new user of jMeter. Trying to implement a set of
> functional
> > > tests in one single test plan.
> > >
> > > In this plan, I need to :
> > >
> > > 1- Send a constant XML-RPC request to a server and grab a value from
> the
> > > result(doing this with Xpath Extractor).
> > > 2- Then send a variable number of XML-RPC requests with values coming
> > from
> > > a csv file(Trying to use a CSV Data config for this)
> > > 3- Finally, send another last XML-RPC request only once.
> > >
> > > It all works as expected (almost) but the last XML-RPC request is
> > repeated
> > > for every line in the CSV Data config file.
> > >
> > > Is it possible to restrict the CSV Data config element to a specific
> > > Sampler or even Logic Controller?
> > >
> > > Thanks in advance,
> > > Jean
> > >
> > > Bellow My current test plan:
> > >
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <jmeterTestPlan version="1.2" properties="2.3">
> > >   <hashTree>
> > >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan"
> > > testname="ATPZero" enabled="true">
> > >       <stringProp name="TestPlan.comments"></stringProp>
> > >       <boolProp name="TestPlan.functional_mode">true</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 name="MSISDN" elementType="Argument">
> > >             <stringProp name="Argument.name">MSISDN</stringProp>
> > >             <stringProp name="Argument.value">66349528</stringProp>
> > >             <stringProp name="Argument.metadata">=</stringProp>
> > >           </elementProp>
> > >           <elementProp name="volDA" elementType="Argument">
> > >             <stringProp name="Argument.name">volDA</stringProp>
> > >             <stringProp name="Argument.value">17</stringProp>
> > >             <stringProp name="Argument.metadata">=</stringProp>
> > >           </elementProp>
> > >           <elementProp name="countDA" elementType="Argument">
> > >             <stringProp name="Argument.name">countDA</stringProp>
> > >             <stringProp name="Argument.value">29</stringProp>
> > >             <stringProp name="Argument.metadata">=</stringProp>
> > >           </elementProp>
> > >           <elementProp name="bonusDA" elementType="Argument">
> > >             <stringProp name="Argument.name">bonusDA</stringProp>
> > >             <stringProp name="Argument.value">42</stringProp>
> > >             <stringProp name="Argument.metadata">=</stringProp>
> > >           </elementProp>
> > >           <elementProp name="MSISDN1" elementType="Argument">
> > >             <stringProp name="Argument.name">MSISDN1</stringProp>
> > >             <stringProp name="Argument.value">66349528</stringProp>
> > >             <stringProp name="Argument.metadata">=</stringProp>
> > >           </elementProp>
> > >         </collectionProp>
> > >       </elementProp>
> > >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
> > >     </TestPlan>
> > >     <hashTree>
> > >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
> > > testname="AutoTester" enabled="true">
> > >         <elementProp name="ThreadGroup.main_controller"
> > > elementType="LoopController" guiclass="LoopControlPanel"
> > > testclass="LoopController" testname="Loop Controller" enabled="true">
> > >           <boolProp
> > name="LoopController.continue_forever">false</boolProp>
> > >           <stringProp name="LoopController.loops">20</stringProp>
> > >         </elementProp>
> > >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
> > >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
> > >         <longProp
> name="ThreadGroup.start_time">1344265518000</longProp>
> > >         <longProp name="ThreadGroup.end_time">1344265518000</longProp>
> > >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
> > >         <stringProp
> > > name="ThreadGroup.on_sample_error">continue</stringProp>
> > >         <stringProp name="ThreadGroup.duration"></stringProp>
> > >         <stringProp name="ThreadGroup.delay"></stringProp>
> > >       </ThreadGroup>
> > >       <hashTree>
> > >         <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager"
> > > testname="HeaderTestLab" enabled="true">
> > >           <collectionProp name="HeaderManager.headers">
> > >             <elementProp name="" elementType="Header">
> > >               <stringProp name="Header.name">User-Agent</stringProp>
> > >               <stringProp name="Header.value">UGw
> > > Server/4.1/1.0</stringProp>
> > >             </elementProp>
> > >             <elementProp name="" elementType="Header">
> > >               <stringProp name="Header.name">Content-Type</stringProp>
> > >               <stringProp name="Header.value">text/xml</stringProp>
> > >             </elementProp>
> > >             <elementProp name="" elementType="Header">
> > >               <stringProp name="Header.name">Authorization</stringProp>
> > >               <stringProp name="Header.value">Basic
> > > 2hda-=asfafaad1</stringProp>
> > >             </elementProp>
> > >           </collectionProp>
> > >           <stringProp name="TestPlan.comments">default ucip headers for
> > > pssim</stringProp>
> > >         </HeaderManager>
> > >         <hashTree/>
> > >         <GenericController guiclass="LogicControllerGui"
> > > testclass="GenericController" testname="BatchRequests" enabled="true"/>
> > >         <hashTree>
> > >           <SoapSampler guiclass="SoapSamplerGui"
> testclass="SoapSampler"
> > > testname="PingUser" enabled="true">
> > >             <elementProp name="HTTPsampler.Arguments"
> > > elementType="Arguments">
> > >               <collectionProp name="Arguments.arguments"/>
> > >             </elementProp>
> > >             <stringProp name="SoapSampler.URL_DATA">
> > > http://192.168.101.120:10010/Air</stringProp>
> > >             <stringProp name="HTTPSamper.xml_data">&lt;?xml
> > > version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
> > > &lt;methodCall&gt;
> > >   &lt;methodName&gt;GetBalanceAndDate&lt;/methodName&gt;
> > >   &lt;params&gt;
> > >     &lt;param&gt;
> > >       &lt;value&gt;
> > >         &lt;struct&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originNodeType&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;EXT&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originHostName&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;USSDGW&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originTransactionID&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;2012080619175629676&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originTimeStamp&lt;/name&gt;
> > >             &lt;value&gt;
> > >
> > > &lt;dateTime.iso8601&gt;20120806T19:17:56+0500&lt;/dateTime.iso8601&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;subscriberNumberNAI&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;i4&gt;1&lt;/i4&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;subscriberNumber&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;${msisdn}&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >         &lt;/struct&gt;
> > >       &lt;/value&gt;
> > >     &lt;/param&gt;
> > >   &lt;/params&gt;
> > > &lt;/methodCall&gt;
> > > </stringProp>
> > >             <stringProp name="SoapSampler.xml_data_file"></stringProp>
> > >             <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
> > >             <stringProp
> > > name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
> > >             <boolProp name="HTTPSampler.use_keepalive">false</boolProp>
> > >           </SoapSampler>
> > >           <hashTree>
> > >             <XPathAssertion guiclass="XPathAssertionGui"
> > > testclass="XPathAssertion" testname="responseOK" enabled="true">
> > >               <boolProp name="XPath.negate">false</boolProp>
> > >               <stringProp
> > > name="XPath.xpath">//member[name=&quot;responseCode&quot; and
> > > value/*=0]</stringProp>
> > >               <boolProp name="XPath.validate">false</boolProp>
> > >               <boolProp name="XPath.whitespace">false</boolProp>
> > >               <boolProp name="XPath.tolerant">false</boolProp>
> > >               <boolProp name="XPath.namespace">false</boolProp>
> > >             </XPathAssertion>
> > >             <hashTree/>
> > >             <XPathExtractor guiclass="XPathExtractorGui"
> > > testclass="XPathExtractor" testname="GetResponseCode" enabled="true">
> > >               <stringProp name="TestPlan.comments">contains the
> response
> > > code</stringProp>
> > >               <stringProp
> name="XPathExtractor.default">100</stringProp>
> > >               <stringProp
> > name="XPathExtractor.refname">rCode</stringProp>
> > >               <stringProp
> > >
> > >
> >
> name="XPathExtractor.xpathQuery">//member[name=&quot;responseCode&quot;]/value/*[1]</stringProp>
> > >               <boolProp name="XPathExtractor.tolerant">false</boolProp>
> > >               <boolProp name="XPathExtractor.namespace">true</boolProp>
> > >               <boolProp name="XPathExtractor.validate">false</boolProp>
> > >             </XPathExtractor>
> > >             <hashTree/>
> > >           </hashTree>
> > >           <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet"
> > > testname="ListOfUsers" enabled="true">
> > >             <stringProp
> > > name="filename">/home/jean/Integration/testmses.csv</stringProp>
> > >             <stringProp name="fileEncoding"></stringProp>
> > >             <stringProp
> > > name="variableNames">msisdn,volDa,volVal,countDa,countVal</stringProp>
> > >             <stringProp name="delimiter">,</stringProp>
> > >             <boolProp name="quotedData">false</boolProp>
> > >             <boolProp name="recycle">true</boolProp>
> > >             <boolProp name="stopThread">false</boolProp>
> > >             <stringProp name="shareMode">All threads</stringProp>
> > >           </CSVDataSet>
> > >           <hashTree/>
> > >         </hashTree>
> > >         <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler"
> > > testname="GetAccountDetails" enabled="true">
> > >           <elementProp name="HTTPsampler.Arguments"
> > > elementType="Arguments">
> > >             <collectionProp name="Arguments.arguments"/>
> > >           </elementProp>
> > >           <stringProp name="SoapSampler.URL_DATA">
> > > http://192.168.101.120:10010/Air</stringProp>
> > >           <stringProp name="HTTPSamper.xml_data">&lt;?xml
> > > version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
> > > &lt;methodCall&gt;
> > >   &lt;methodName&gt;GetAccountDetails&lt;/methodName&gt;
> > >   &lt;params&gt;
> > >     &lt;param&gt;
> > >       &lt;value&gt;
> > >         &lt;struct&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originNodeType&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;${originNodeType}&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originHostName&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;${originHostName}&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originTransactionID&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;${transaction_id}&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;originTimeStamp&lt;/name&gt;
> > >             &lt;value&gt;
> > >
> > &lt;dateTime.iso8601&gt;${timestamp}&lt;/dateTime.iso8601&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;subscriberNumberNAI&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;i4&gt;${subscriberNumberNAI}&lt;/i4&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;subscriberNumber&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;string&gt;${subscriberNumber}&lt;/string&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >           &lt;member&gt;
> > >             &lt;name&gt;requestedInformationFlags&lt;/name&gt;
> > >             &lt;value&gt;
> > >               &lt;struct&gt;
> > >                 &lt;member&gt;
> > >
> > &lt;name&gt;requestMasterAccountBalanceFlag&lt;/name&gt;
> > >                   &lt;value&gt;
> > >                     &lt;boolean&gt;1&lt;/boolean&gt;
> > >                   &lt;/value&gt;
> > >                 &lt;/member&gt;
> > >               &lt;/struct&gt;
> > >             &lt;/value&gt;
> > >           &lt;/member&gt;
> > >         &lt;/struct&gt;
> > >       &lt;/value&gt;
> > >     &lt;/param&gt;
> > >   &lt;/params&gt;
> > > &lt;/methodCall&gt;</stringProp>
> > >           <stringProp name="SoapSampler.xml_data_file"></stringProp>
> > >           <stringProp name="SoapSampler.SOAP_ACTION"></stringProp>
> > >           <stringProp
> > > name="SoapSampler.SEND_SOAP_ACTION">false</stringProp>
> > >           <boolProp name="HTTPSampler.use_keepalive">false</boolProp>
> > >         </SoapSampler>
> > >         <hashTree>
> > >           <XPathAssertion guiclass="XPathAssertionGui"
> > > testclass="XPathAssertion" testname="responseOK" enabled="true">
> > >             <boolProp name="XPath.negate">false</boolProp>
> > >             <stringProp
> > > name="XPath.xpath">//member[name=&quot;responseCode&quot; and
> > > value/*=0]</stringProp>
> > >             <boolProp name="XPath.validate">false</boolProp>
> > >             <boolProp name="XPath.whitespace">false</boolProp>
> > >             <boolProp name="XPath.tolerant">false</boolProp>
> > >             <boolProp name="XPath.namespace">false</boolProp>
> > >           </XPathAssertion>
> > >           <hashTree/>
> > >           <XPathExtractor guiclass="XPathExtractorGui"
> > > testclass="XPathExtractor" testname="GetResponseCode" enabled="true">
> > >             <stringProp name="TestPlan.comments">contains the response
> > > code</stringProp>
> > >             <stringProp name="XPathExtractor.default">100</stringProp>
> > >             <stringProp
> name="XPathExtractor.refname">rCode2</stringProp>
> > >             <stringProp
> > >
> > >
> >
> name="XPathExtractor.xpathQuery">//member[name=&quot;responseCode&quot;]/value/*[1]</stringProp>
> > >             <boolProp name="XPathExtractor.tolerant">false</boolProp>
> > >             <boolProp name="XPathExtractor.namespace">true</boolProp>
> > >             <boolProp name="XPathExtractor.validate">false</boolProp>
> > >           </XPathExtractor>
> > >           <hashTree/>
> > >         </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>true</xml>
> > >               <fieldNames>false</fieldNames>
> > >               <responseHeaders>false</responseHeaders>
> > >               <requestHeaders>false</requestHeaders>
> > >               <responseDataOnError>false</responseDataOnError>
> > >
> > >
> > >
> >
> <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
> > >               <assertionsResultsToSave>0</assertionsResultsToSave>
> > >               <bytes>true</bytes>
> > >             </value>
> > >           </objProp>
> > >           <stringProp name="filename"></stringProp>
> > >         </ResultCollector>
> > >         <hashTree/>
> > >       </hashTree>
> > >     </hashTree>
> > >   </hashTree>
> > > </jmeterTestPlan>
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message