jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Adding more data to sampleResults
Date Tue, 01 Mar 2005 12:57:25 GMT
On Tue, 1 Mar 2005 13:45:23 +0100, Jordi Buj <jordibuj@hotmail.com> wrote:
> Thanks Sebb for your answer, your suggestion is enough for my needs and
> definitely better than having 2 samplers.
> Just one question: if I put the script in a file then I don't seem to have
> access to the ${time} variables.
> Am I doing something wrong?

No, you are not doing anything wrong.

JMeter does not replace function calls or varaibles in files - only in
scripts which are coded in the test element itself.

One way to look at this is: if a function call / variable reference is
not visible on the test element screen, it won't be seen by JMeter
either.

However, you can pass parameters to scripts, or you can use a startup
script (see jmeter.properties) to predefine some methods that you can
then invoke in the script pane, passing in the contents of
functions/variables as needed. Remember that JMeter does textual
replacement of the variable/function, so if the result needs to be
quoted, you'll need to add the quotes.

e.g. 
a="fixed string";
b="${VAR}";

Or you can code the extraction in the script itself, and eliminate the
need for a separate extraction phase.

> 
> *jordi
> 
> ----- Original Message -----
> From: "sebb" <sebbaz@gmail.com>
> To: "JMeter Users List" <jmeter-user@jakarta.apache.org>
> Sent: Sunday, February 27, 2005 20:16
> Subject: Re: Adding more data to sampleResults
> 
> > On Sat, 26 Feb 2005 23:05:05 +0100, Jordi Buj <jordibuj@hotmail.com>
> wrote:
> > > Hi,
> > > I'm a beginner with JMeter - it's great - thanks!
> > > I want to test a J2EE application that contains performance data in
> every response, basically the amount of time spent in the different layers
> (web application, JCA connector and the EIS).
> > > What I'd like to do ideally is to extract the data from the response and
> have it included in the output file, something like:
> > > <sampleResult threadName="..." ... time="300" eisTime="30" JCATime="80"
> webappTime="100"/>
> > >
> > > I've read the manual, the articles and searched the mailing list, and my
> "newbie" solution so far is to add a JavaRequest/JavaTest to each
> HttpRequest to output the extra times. That doubles the sampleResults and is
> more complex to process, but is about right for me
> > > Just wanted to ask here if I could do it better as explained above.
> > >
> > > Any guess?
> >
> > As you have discovered, the only way currently to put data in the
> > JMeter Test Log (.jtl) file is via sampler data.
> >
> > You can change the fields which are saved (by changing
> > jmeter.properties), but you cannot currently add extra output to the
> > file.
> >
> > If the test is run in functional test mode, the JTL file will contain
> > the entire response, including the J2EE performance data. The response
> > data would have to be scanned for the information later, and the file
> > could get rather large - but it would eliminate the extra samples...
> >
> > The only work-round I can think of is to amend the sample result so
> > that the data you want is added to one of the fields that is currently
> > available for output to the result file.
> >
> > One way to do this is to use the BeanShell Assertion:
> >
> >
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Assertion
> >
> > This has read/write access to the Failure flag and the Failure
> > Message, neither of which are really suitable. It also has access to
> > the Response object itself, which means it can be used to change any
> > fields that the response object gives access to.
> >
> > For example:
> >
> > Response.setSampleLabel("eisTime=30 JCATime=80");
> >
> > The BSH Assertion could either extract the values directly from the
> > ResponseData byte[] variable, or the script could make use of any
> > JMeter variables set by previous Regex extractor(s), e.g.
> >
> > Response.setSampleLabel("eisTime=${EIST} JCATime=${JCAT}");
> >
> > where EIST and JCAT are JMeter variables with the appropriate contents.
> >
> > Not exactly an elegant solution, and you would have to parse the label
> > text, but it does work...
> >
> > > *jordi
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message