You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Whatis myname <my...@gmail.com> on 2010/06/18 17:56:56 UTC

Problem setting JMeter to read the .csv file

I am trying to get JMeter to read data from a .csv file to perfrom the load
testing.

The method which is being used is:

 public void log(String transactionId, String principal, String eventName,
String eventType, int status, String[] contexts, IAuditData[] datas)


I created a sample .csv file, and tried to make JMeter read data from it. I
added the csv data set configuration element and then added the following
variables under the variable names section:

transactionId, principal,eventName,eventType,status,contexts, datas


I also added them to the http request element.

I am not sure how to add the last argument both in the csv file and in
JMeter. The first six arguments are all primitive types ( though I am not
sure how to add the String [] too, but for now I am just adding a single
string value.), but the last argument is an object, which itself is a name,
value pair. So an Audit data would contain a name( which is a string, and a
value, which is also a string.). So I am not sure how can I add it in the
excel file as well as in the Jmeter config.


This is what my excel file looks like right now without the data for the
last argument:


transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts
transactionID1    principal1    eventname1    eventtype1    0    Contexts


The soap message is supposed to look like this ( with an empty string array
passed in as the sixth argument):


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
"><soap:Body>
<ns1:log xmlns:ns1="http://auditservice.auditing.asdf.comp.com/
"><ns1:transactionId>THX-4EVR-0</ns1:transactionId>

<ns1:principal>ANONYMOUS</ns1:principal>

<ns1:eventName>ExtremeLogonAttempt</ns1:eventName>

<ns1:eventType>ExtremeSecurity</ns1:eventType>

<ns1:status>0</ns1:status>

<ns1:contexts />

<ns1:datas><ns2:IAuditData xmlns:ns2="
http://iauditdata.auditing.asdf.comp.com
"><ns2:name>com.comp.security.auditing.data.CurrentDate</ns2:name>

<ns2:value>2010-06-18 14:21:23.917</ns2:value>

</ns2:IAuditData><ns2:IAuditData xmlns:ns2="
http://iauditdata.auditing.asdf.comp.com">

<ns2:name>com.comp.security.auditing.data.AuditSource</ns2:name>

<ns2:value>Legal Source</ns2:value>

</ns2:IAuditData></ns1:datas></ns1:log></soap:Body></soap:Envelope>


Can someone help me with how to add the last argument, and also what if the
sixth argument was an array instead of a single value.

Re: Problem setting JMeter to read the .csv file

Posted by Whatis myname <my...@gmail.com>.
Thanks for all the help... I was pointing to the excel file, but it was not
in the right format (.csv). And in my delimiter it was comma separated in
the csv config element. So probably it was not reading the file. It works
now.

On Fri, Jun 18, 2010 at 12:01 PM, Deepak Shetty <sh...@gmail.com> wrote:

> hi
> Im not sure of ther exact structure of your test , are yoiu using the web
> service related sampler (since you keep showing a java method, Im not sure
> of this) and are you using substituting variables or something else?.
>
> Add a View Results Tree Listener and a debug sampler to your test. The
> debug
> sampler can show you the value of the variables the the view results tree
> lisntener can show you the exact XML being posted. You can compare that to
> working XML and see whats breaking.
>
> regards
> deepak
>
> On Fri, Jun 18, 2010 at 9:39 AM, Whatis myname <myname.whatis@gmail.com
> >wrote:
>
> > Thanks for the reply. I will try, and see how it goes.
> >
> > By the way I forgot to mention that the last argument ( datas - the one
> > with
> > the name value pair is optional). So I can pass in values to the method
> > without passing in that argument, and it would still work fine. I tried
> it
> > in my soap message and passed it to JMeter ( without that last argument),
> > and it worked. I also added the value 'contexts' in the soap message for
> > the
> > sixth argument ( instead of passing in an empty contexts array as
> before),
> > and it still worked. But then when I try to do it using the. csv data
> file
> > (
> > the same file I sent before), it is giving me the following error:
> >
> >
> > [6/18/10 11:22:38:562 CDT] 0000003d PhaseIntercep W
> > org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging Interceptor
> for
> > {http://auditservice.auditing.asdf.comp.com/}AuditServiceService<http://auditservice.auditing.asdf.comp.com/%7DAuditServiceService>
> <http://auditservice.auditing.asdf.comp.com/%7DAuditServiceService>has
> thrown
> > exception, unwinding now
> >                                 org.apache.cxf.binding.soap.SoapFault:
> > Error reading XMLStreamReader.
> >                                                                    .
> >                                                                    .
> >                                                                    .
> >                                                                    .
> >                                                                    .
> >                                                                    .
> >
> > Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected
> > character 't' (code 116) in prolog; expected '<'
> >  at [row,col {unknown-source}]: [1,1]
> >    at
> > com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
> >    at
> >
> >
> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
> >                                                                  .
> >                                                                  .
> >                                                                  .
> >                                                                  .
> >                                                                  .
> >
> > I have basically tried to match everything in my data file to the SOAP
> > message that is being successfully processed. But I am unable to get rid
> of
> > this error. Maybe I am missing something, or something is incorrect?
> >
> >
> >
> >
> >
> > On Fri, Jun 18, 2010 at 11:20 AM, Deepak Shetty <sh...@gmail.com>
> wrote:
> >
> > > There isnt a straight forward way to do this . In the specific case of
> a
> > > name value pair , you can model this as two columns.
> > > In the case of arrays you have some options
> > > a. If you can fix the maximum number of elements you can keep as many
> > > columns as the max number (leave them empty when you have no data) and
> > you
> > > can have your JMeter conditionally add non empty parameters
> > > b. You can use a separate delimiting scheme and parse that in bsh
> > > e.g. "a","b","c~d~e","f" where the third column is actually an array
> > > ["c","d","e"]. You then use BSH or javaScript to parse this third
> String.
> > > c. You can store your XML and just have the CSV point to the location
> of
> > > the
> > > XML (or have the entire XML as a single column ). I did this once using
> > > JSON
> > > as the format.
> > > d. You can store complex data in a separate file which shares a common
> > key
> > > with the CSV file. And read that from BSH
> > > So CSV will have
> > > "key1","a","b","c"
> > > "key2","d","e","f"
> > > and the other file read by BSH will have
> > > "key1","x"
> > > "key1","y"
> > > "key2","z"
> > >
> > > regards
> > > deepak
> > >
> > >
> > > On Fri, Jun 18, 2010 at 8:56 AM, Whatis myname <
> myname.whatis@gmail.com
> > > >wrote:
> > >
> > > > I am trying to get JMeter to read data from a .csv file to perfrom
> the
> > > load
> > > > testing.
> > > >
> > > > The method which is being used is:
> > > >
> > > >  public void log(String transactionId, String principal, String
> > > eventName,
> > > > String eventType, int status, String[] contexts, IAuditData[] datas)
> > > >
> > > >
> > > > I created a sample .csv file, and tried to make JMeter read data from
> > it.
> > > I
> > > > added the csv data set configuration element and then added the
> > following
> > > > variables under the variable names section:
> > > >
> > > > transactionId, principal,eventName,eventType,status,contexts, datas
> > > >
> > > >
> > > > I also added them to the http request element.
> > > >
> > > > I am not sure how to add the last argument both in the csv file and
> in
> > > > JMeter. The first six arguments are all primitive types ( though I am
> > not
> > > > sure how to add the String [] too, but for now I am just adding a
> > single
> > > > string value.), but the last argument is an object, which itself is a
> > > name,
> > > > value pair. So an Audit data would contain a name( which is a string,
> > and
> > > a
> > > > value, which is also a string.). So I am not sure how can I add it in
> > the
> > > > excel file as well as in the Jmeter config.
> > > >
> > > >
> > > > This is what my excel file looks like right now without the data for
> > the
> > > > last argument:
> > > >
> > > >
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > > transactionID1    principal1    eventname1    eventtype1    0
> >  Contexts
> > > >
> > > >
> > > > The soap message is supposed to look like this ( with an empty string
> > > array
> > > > passed in as the sixth argument):
> > > >
> > > >
> > > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
> > > > "><soap:Body>
> > > > <ns1:log xmlns:ns1="http://auditservice.auditing.asdf.comp.com/
> > > > "><ns1:transactionId>THX-4EVR-0</ns1:transactionId>
> > > >
> > > > <ns1:principal>ANONYMOUS</ns1:principal>
> > > >
> > > > <ns1:eventName>ExtremeLogonAttempt</ns1:eventName>
> > > >
> > > > <ns1:eventType>ExtremeSecurity</ns1:eventType>
> > > >
> > > > <ns1:status>0</ns1:status>
> > > >
> > > > <ns1:contexts />
> > > >
> > > > <ns1:datas><ns2:IAuditData xmlns:ns2="
> > > > http://iauditdata.auditing.asdf.comp.com
> > > > "><ns2:name>com.comp.security.auditing.data.CurrentDate</ns2:name>
> > > >
> > > > <ns2:value>2010-06-18 14:21:23.917</ns2:value>
> > > >
> > > > </ns2:IAuditData><ns2:IAuditData xmlns:ns2="
> > > > http://iauditdata.auditing.asdf.comp.com">
> > > >
> > > > <ns2:name>com.comp.security.auditing.data.AuditSource</ns2:name>
> > > >
> > > > <ns2:value>Legal Source</ns2:value>
> > > >
> > > > </ns2:IAuditData></ns1:datas></ns1:log></soap:Body></soap:Envelope>
> > > >
> > > >
> > > > Can someone help me with how to add the last argument, and also what
> if
> > > the
> > > > sixth argument was an array instead of a single value.
> > > >
> > >
> >
>

Re: Problem setting JMeter to read the .csv file

Posted by Deepak Shetty <sh...@gmail.com>.
hi
Im not sure of ther exact structure of your test , are yoiu using the web
service related sampler (since you keep showing a java method, Im not sure
of this) and are you using substituting variables or something else?.

Add a View Results Tree Listener and a debug sampler to your test. The debug
sampler can show you the value of the variables the the view results tree
lisntener can show you the exact XML being posted. You can compare that to
working XML and see whats breaking.

regards
deepak

On Fri, Jun 18, 2010 at 9:39 AM, Whatis myname <my...@gmail.com>wrote:

> Thanks for the reply. I will try, and see how it goes.
>
> By the way I forgot to mention that the last argument ( datas - the one
> with
> the name value pair is optional). So I can pass in values to the method
> without passing in that argument, and it would still work fine. I tried it
> in my soap message and passed it to JMeter ( without that last argument),
> and it worked. I also added the value 'contexts' in the soap message for
> the
> sixth argument ( instead of passing in an empty contexts array as before),
> and it still worked. But then when I try to do it using the. csv data file
> (
> the same file I sent before), it is giving me the following error:
>
>
> [6/18/10 11:22:38:562 CDT] 0000003d PhaseIntercep W
> org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging Interceptor for
> {http://auditservice.auditing.asdf.comp.com/}AuditServiceService<http://auditservice.auditing.asdf.comp.com/%7DAuditServiceService>has thrown
> exception, unwinding now
>                                 org.apache.cxf.binding.soap.SoapFault:
> Error reading XMLStreamReader.
>                                                                    .
>                                                                    .
>                                                                    .
>                                                                    .
>                                                                    .
>                                                                    .
>
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected
> character 't' (code 116) in prolog; expected '<'
>  at [row,col {unknown-source}]: [1,1]
>    at
> com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
>    at
>
> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
>                                                                  .
>                                                                  .
>                                                                  .
>                                                                  .
>                                                                  .
>
> I have basically tried to match everything in my data file to the SOAP
> message that is being successfully processed. But I am unable to get rid of
> this error. Maybe I am missing something, or something is incorrect?
>
>
>
>
>
> On Fri, Jun 18, 2010 at 11:20 AM, Deepak Shetty <sh...@gmail.com> wrote:
>
> > There isnt a straight forward way to do this . In the specific case of a
> > name value pair , you can model this as two columns.
> > In the case of arrays you have some options
> > a. If you can fix the maximum number of elements you can keep as many
> > columns as the max number (leave them empty when you have no data) and
> you
> > can have your JMeter conditionally add non empty parameters
> > b. You can use a separate delimiting scheme and parse that in bsh
> > e.g. "a","b","c~d~e","f" where the third column is actually an array
> > ["c","d","e"]. You then use BSH or javaScript to parse this third String.
> > c. You can store your XML and just have the CSV point to the location of
> > the
> > XML (or have the entire XML as a single column ). I did this once using
> > JSON
> > as the format.
> > d. You can store complex data in a separate file which shares a common
> key
> > with the CSV file. And read that from BSH
> > So CSV will have
> > "key1","a","b","c"
> > "key2","d","e","f"
> > and the other file read by BSH will have
> > "key1","x"
> > "key1","y"
> > "key2","z"
> >
> > regards
> > deepak
> >
> >
> > On Fri, Jun 18, 2010 at 8:56 AM, Whatis myname <myname.whatis@gmail.com
> > >wrote:
> >
> > > I am trying to get JMeter to read data from a .csv file to perfrom the
> > load
> > > testing.
> > >
> > > The method which is being used is:
> > >
> > >  public void log(String transactionId, String principal, String
> > eventName,
> > > String eventType, int status, String[] contexts, IAuditData[] datas)
> > >
> > >
> > > I created a sample .csv file, and tried to make JMeter read data from
> it.
> > I
> > > added the csv data set configuration element and then added the
> following
> > > variables under the variable names section:
> > >
> > > transactionId, principal,eventName,eventType,status,contexts, datas
> > >
> > >
> > > I also added them to the http request element.
> > >
> > > I am not sure how to add the last argument both in the csv file and in
> > > JMeter. The first six arguments are all primitive types ( though I am
> not
> > > sure how to add the String [] too, but for now I am just adding a
> single
> > > string value.), but the last argument is an object, which itself is a
> > name,
> > > value pair. So an Audit data would contain a name( which is a string,
> and
> > a
> > > value, which is also a string.). So I am not sure how can I add it in
> the
> > > excel file as well as in the Jmeter config.
> > >
> > >
> > > This is what my excel file looks like right now without the data for
> the
> > > last argument:
> > >
> > >
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > > transactionID1    principal1    eventname1    eventtype1    0
>  Contexts
> > >
> > >
> > > The soap message is supposed to look like this ( with an empty string
> > array
> > > passed in as the sixth argument):
> > >
> > >
> > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
> > > "><soap:Body>
> > > <ns1:log xmlns:ns1="http://auditservice.auditing.asdf.comp.com/
> > > "><ns1:transactionId>THX-4EVR-0</ns1:transactionId>
> > >
> > > <ns1:principal>ANONYMOUS</ns1:principal>
> > >
> > > <ns1:eventName>ExtremeLogonAttempt</ns1:eventName>
> > >
> > > <ns1:eventType>ExtremeSecurity</ns1:eventType>
> > >
> > > <ns1:status>0</ns1:status>
> > >
> > > <ns1:contexts />
> > >
> > > <ns1:datas><ns2:IAuditData xmlns:ns2="
> > > http://iauditdata.auditing.asdf.comp.com
> > > "><ns2:name>com.comp.security.auditing.data.CurrentDate</ns2:name>
> > >
> > > <ns2:value>2010-06-18 14:21:23.917</ns2:value>
> > >
> > > </ns2:IAuditData><ns2:IAuditData xmlns:ns2="
> > > http://iauditdata.auditing.asdf.comp.com">
> > >
> > > <ns2:name>com.comp.security.auditing.data.AuditSource</ns2:name>
> > >
> > > <ns2:value>Legal Source</ns2:value>
> > >
> > > </ns2:IAuditData></ns1:datas></ns1:log></soap:Body></soap:Envelope>
> > >
> > >
> > > Can someone help me with how to add the last argument, and also what if
> > the
> > > sixth argument was an array instead of a single value.
> > >
> >
>

Re: Problem setting JMeter to read the .csv file

Posted by Whatis myname <my...@gmail.com>.
Thanks for the reply. I will try, and see how it goes.

By the way I forgot to mention that the last argument ( datas - the one with
the name value pair is optional). So I can pass in values to the method
without passing in that argument, and it would still work fine. I tried it
in my soap message and passed it to JMeter ( without that last argument),
and it worked. I also added the value 'contexts' in the soap message for the
sixth argument ( instead of passing in an empty contexts array as before),
and it still worked. But then when I try to do it using the. csv data file (
the same file I sent before), it is giving me the following error:


[6/18/10 11:22:38:562 CDT] 0000003d PhaseIntercep W
org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging Interceptor for
{http://auditservice.auditing.asdf.comp.com/}AuditServiceService has thrown
exception, unwinding now
                                 org.apache.cxf.binding.soap.SoapFault:
Error reading XMLStreamReader.
                                                                    .
                                                                    .
                                                                    .
                                                                    .
                                                                    .
                                                                    .

Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected
character 't' (code 116) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
    at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
    at
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
                                                                  .
                                                                  .
                                                                  .
                                                                  .
                                                                  .

I have basically tried to match everything in my data file to the SOAP
message that is being successfully processed. But I am unable to get rid of
this error. Maybe I am missing something, or something is incorrect?





On Fri, Jun 18, 2010 at 11:20 AM, Deepak Shetty <sh...@gmail.com> wrote:

> There isnt a straight forward way to do this . In the specific case of a
> name value pair , you can model this as two columns.
> In the case of arrays you have some options
> a. If you can fix the maximum number of elements you can keep as many
> columns as the max number (leave them empty when you have no data) and you
> can have your JMeter conditionally add non empty parameters
> b. You can use a separate delimiting scheme and parse that in bsh
> e.g. "a","b","c~d~e","f" where the third column is actually an array
> ["c","d","e"]. You then use BSH or javaScript to parse this third String.
> c. You can store your XML and just have the CSV point to the location of
> the
> XML (or have the entire XML as a single column ). I did this once using
> JSON
> as the format.
> d. You can store complex data in a separate file which shares a common key
> with the CSV file. And read that from BSH
> So CSV will have
> "key1","a","b","c"
> "key2","d","e","f"
> and the other file read by BSH will have
> "key1","x"
> "key1","y"
> "key2","z"
>
> regards
> deepak
>
>
> On Fri, Jun 18, 2010 at 8:56 AM, Whatis myname <myname.whatis@gmail.com
> >wrote:
>
> > I am trying to get JMeter to read data from a .csv file to perfrom the
> load
> > testing.
> >
> > The method which is being used is:
> >
> >  public void log(String transactionId, String principal, String
> eventName,
> > String eventType, int status, String[] contexts, IAuditData[] datas)
> >
> >
> > I created a sample .csv file, and tried to make JMeter read data from it.
> I
> > added the csv data set configuration element and then added the following
> > variables under the variable names section:
> >
> > transactionId, principal,eventName,eventType,status,contexts, datas
> >
> >
> > I also added them to the http request element.
> >
> > I am not sure how to add the last argument both in the csv file and in
> > JMeter. The first six arguments are all primitive types ( though I am not
> > sure how to add the String [] too, but for now I am just adding a single
> > string value.), but the last argument is an object, which itself is a
> name,
> > value pair. So an Audit data would contain a name( which is a string, and
> a
> > value, which is also a string.). So I am not sure how can I add it in the
> > excel file as well as in the Jmeter config.
> >
> >
> > This is what my excel file looks like right now without the data for the
> > last argument:
> >
> >
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> > transactionID1    principal1    eventname1    eventtype1    0    Contexts
> >
> >
> > The soap message is supposed to look like this ( with an empty string
> array
> > passed in as the sixth argument):
> >
> >
> > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
> > "><soap:Body>
> > <ns1:log xmlns:ns1="http://auditservice.auditing.asdf.comp.com/
> > "><ns1:transactionId>THX-4EVR-0</ns1:transactionId>
> >
> > <ns1:principal>ANONYMOUS</ns1:principal>
> >
> > <ns1:eventName>ExtremeLogonAttempt</ns1:eventName>
> >
> > <ns1:eventType>ExtremeSecurity</ns1:eventType>
> >
> > <ns1:status>0</ns1:status>
> >
> > <ns1:contexts />
> >
> > <ns1:datas><ns2:IAuditData xmlns:ns2="
> > http://iauditdata.auditing.asdf.comp.com
> > "><ns2:name>com.comp.security.auditing.data.CurrentDate</ns2:name>
> >
> > <ns2:value>2010-06-18 14:21:23.917</ns2:value>
> >
> > </ns2:IAuditData><ns2:IAuditData xmlns:ns2="
> > http://iauditdata.auditing.asdf.comp.com">
> >
> > <ns2:name>com.comp.security.auditing.data.AuditSource</ns2:name>
> >
> > <ns2:value>Legal Source</ns2:value>
> >
> > </ns2:IAuditData></ns1:datas></ns1:log></soap:Body></soap:Envelope>
> >
> >
> > Can someone help me with how to add the last argument, and also what if
> the
> > sixth argument was an array instead of a single value.
> >
>

Re: Problem setting JMeter to read the .csv file

Posted by Deepak Shetty <sh...@gmail.com>.
There isnt a straight forward way to do this . In the specific case of a
name value pair , you can model this as two columns.
In the case of arrays you have some options
a. If you can fix the maximum number of elements you can keep as many
columns as the max number (leave them empty when you have no data) and you
can have your JMeter conditionally add non empty parameters
b. You can use a separate delimiting scheme and parse that in bsh
e.g. "a","b","c~d~e","f" where the third column is actually an array
["c","d","e"]. You then use BSH or javaScript to parse this third String.
c. You can store your XML and just have the CSV point to the location of the
XML (or have the entire XML as a single column ). I did this once using JSON
as the format.
d. You can store complex data in a separate file which shares a common key
with the CSV file. And read that from BSH
So CSV will have
"key1","a","b","c"
"key2","d","e","f"
and the other file read by BSH will have
"key1","x"
"key1","y"
"key2","z"

regards
deepak


On Fri, Jun 18, 2010 at 8:56 AM, Whatis myname <my...@gmail.com>wrote:

> I am trying to get JMeter to read data from a .csv file to perfrom the load
> testing.
>
> The method which is being used is:
>
>  public void log(String transactionId, String principal, String eventName,
> String eventType, int status, String[] contexts, IAuditData[] datas)
>
>
> I created a sample .csv file, and tried to make JMeter read data from it. I
> added the csv data set configuration element and then added the following
> variables under the variable names section:
>
> transactionId, principal,eventName,eventType,status,contexts, datas
>
>
> I also added them to the http request element.
>
> I am not sure how to add the last argument both in the csv file and in
> JMeter. The first six arguments are all primitive types ( though I am not
> sure how to add the String [] too, but for now I am just adding a single
> string value.), but the last argument is an object, which itself is a name,
> value pair. So an Audit data would contain a name( which is a string, and a
> value, which is also a string.). So I am not sure how can I add it in the
> excel file as well as in the Jmeter config.
>
>
> This is what my excel file looks like right now without the data for the
> last argument:
>
>
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
> transactionID1    principal1    eventname1    eventtype1    0    Contexts
>
>
> The soap message is supposed to look like this ( with an empty string array
> passed in as the sixth argument):
>
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
> "><soap:Body>
> <ns1:log xmlns:ns1="http://auditservice.auditing.asdf.comp.com/
> "><ns1:transactionId>THX-4EVR-0</ns1:transactionId>
>
> <ns1:principal>ANONYMOUS</ns1:principal>
>
> <ns1:eventName>ExtremeLogonAttempt</ns1:eventName>
>
> <ns1:eventType>ExtremeSecurity</ns1:eventType>
>
> <ns1:status>0</ns1:status>
>
> <ns1:contexts />
>
> <ns1:datas><ns2:IAuditData xmlns:ns2="
> http://iauditdata.auditing.asdf.comp.com
> "><ns2:name>com.comp.security.auditing.data.CurrentDate</ns2:name>
>
> <ns2:value>2010-06-18 14:21:23.917</ns2:value>
>
> </ns2:IAuditData><ns2:IAuditData xmlns:ns2="
> http://iauditdata.auditing.asdf.comp.com">
>
> <ns2:name>com.comp.security.auditing.data.AuditSource</ns2:name>
>
> <ns2:value>Legal Source</ns2:value>
>
> </ns2:IAuditData></ns1:datas></ns1:log></soap:Body></soap:Envelope>
>
>
> Can someone help me with how to add the last argument, and also what if the
> sixth argument was an array instead of a single value.
>