As I've been reading the mailing list it has become apparent that the
beanshell is a very powerful tool that can operate directly on a variety
of JMeter global variables. For example in a recent thread a beanshell
post-processor modified the previous response data with:

String sampleResult = new String(prev.getResponseData());
String temp = sampleResult.substring(0,sampleResult.length()-1);
prev.setResponseData(temp.getBytes());

I'd like to learn more about the JMeter variable prev and its kin. I've
taken a peak at the JavaDocs and searched the source but I'm feeling a
bit overwhelmed. Would someone please help me narrow my search? 

Thanks,
Ron

-----Original Message-----
From: Knut Borchart [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 13, 2007 3:24 PM
To: JMeter Users List
Subject: Re: Cleaning content of response before assertions (was:
Question about XPath)

Hi,

i was able to use a beanshell post-processor to clean the response:

String sampleResult = new String(prev.getResponseData());
String temp = sampleResult.substring(0,sampleResult.length()-1);
prev.setResponseData(temp.getBytes());

I have added two such beanshell post-processor parts to my test plan,
so all response data should be cleaned before xpath assertion and
extraction are done.

But unfortunately this does only work for the assertion, not for the
xpath extraction. It seems like the extraction is evaluated before the
beanshell post-processor, despite the sort order in the test plan. Is
there anything i can do to circumvent this problem?

Kind regards, knut

2007/6/12, sebb <[EMAIL PROTECTED]>:
> Have you tried the tolerant check-box?
>
> Assertions are processed after Post-Processors:
>
>
http://jakarta.apache.org/jmeter/usermanual/test_plan.html#executionorde
r
>
> so you can use a BeanShell Post-Processor to update the sampleData and
> strip off the garbage.
>
> But really, the server ought to be fixed to return valid XML.
>
> You can use the Save Responses to a file Post-Processor to create a
> copy of the data as evidence ;-).
>
> S.
> On 12/06/07, Knut Borchart <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > it seems my problem with xpath (assertion/extraction) i mentioned in
> > another posting was caused by the application server sending a
strange
> > character at the end of the response (displayed like a rectangle,
> > cannot paste here)
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <CompositeResponse elapsed="0" date="2007-06-08T10:36:21+0100">
> >    <CustomerBalanceResponse balance="400.00"/>
> >    <FOOpenGameResponse gameId="12345678" nextDrawId="0"/>
> > </CompositeResponse>\something
> >
> > How can i clean the response content before applying xpath
assertions
> > or extractions? I think i could strip the last character with a
> > regular expression post processor, but how to call the reference so
> > that the response content is overwritten?
> >
> > TIA, peter
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to