You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by blackgaff <jo...@gmail.com> on 2009/07/16 20:32:08 UTC

Re: asserting PDF responses?

This is handy for asserting what KIND of file was returned, but is there a
way to assert against text WITHIN the PDF? IE, I want to create an assertion
that tells me if the rendered document contains the word "free bird".


The aforementioned solution involves using an HTTP sampler to retrieve
the PDF file, checking the response to ensure that it starts with a
standard PDF header, "%PDF-1.4" or something similar.

If the response doesn't start with a PDF header, then there has likely
been an error, and you have not been given a PDF file.


-- 
View this message in context: http://www.nabble.com/asserting-PDF-responses--tp16863041p24521998.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: asserting PDF responses?

Posted by Deepak Shetty <sh...@gmail.com>.
I made a mistake , it looks like iText doesnt extract text out of PDF's ,
you need something like http://incubator.apache.org/pdfbox/
There are some caveats to extracting text out of PDF, as well as there are
other libraries too i suppose...
regards
deepak

On Thu, Jul 16, 2009 at 11:49 AM, blackgaff <jo...@gmail.com>wrote:

>
> Thanks for the quick response - looks like I"ll get to learn BeanSheel and
> iText.
>
>
> Deepak Shetty wrote:
> >
> >>but is there a way to assert against text WITHIN the PDF
> > If you really wanted to do this  then you'd have to interpret the
> > response(for any binary file) and check it
> > in this case BSH Post Processor (or equivalent) plus iText (to parse the
> > PDF
> > and get its text out)
> >
> > regards
> > deepak
> >
> > On Thu, Jul 16, 2009 at 11:32 AM, blackgaff
> > <jo...@gmail.com>wrote:
> >
> >>
> >> This is handy for asserting what KIND of file was returned, but is there
> >> a
> >> way to assert against text WITHIN the PDF? IE, I want to create an
> >> assertion
> >> that tells me if the rendered document contains the word "free bird".
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/asserting-PDF-responses--tp16863041p24522298.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: asserting PDF responses?

Posted by blackgaff <jo...@gmail.com>.
Thanks for the quick response - looks like I"ll get to learn BeanSheel and
iText.


Deepak Shetty wrote:
> 
>>but is there a way to assert against text WITHIN the PDF
> If you really wanted to do this  then you'd have to interpret the
> response(for any binary file) and check it
> in this case BSH Post Processor (or equivalent) plus iText (to parse the
> PDF
> and get its text out)
> 
> regards
> deepak
> 
> On Thu, Jul 16, 2009 at 11:32 AM, blackgaff
> <jo...@gmail.com>wrote:
> 
>>
>> This is handy for asserting what KIND of file was returned, but is there
>> a
>> way to assert against text WITHIN the PDF? IE, I want to create an
>> assertion
>> that tells me if the rendered document contains the word "free bird".
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/asserting-PDF-responses--tp16863041p24522298.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: asserting PDF responses?

Posted by Deepak Shetty <sh...@gmail.com>.
>but is there a way to assert against text WITHIN the PDF
If you really wanted to do this  then you'd have to interpret the
response(for any binary file) and check it
in this case BSH Post Processor (or equivalent) plus iText (to parse the PDF
and get its text out)

regards
deepak

On Thu, Jul 16, 2009 at 11:32 AM, blackgaff <jo...@gmail.com>wrote:

>
> This is handy for asserting what KIND of file was returned, but is there a
> way to assert against text WITHIN the PDF? IE, I want to create an
> assertion
> that tells me if the rendered document contains the word "free bird".
>
>
> The aforementioned solution involves using an HTTP sampler to retrieve
> the PDF file, checking the response to ensure that it starts with a
> standard PDF header, "%PDF-1.4" or something similar.
>
> If the response doesn't start with a PDF header, then there has likely
> been an error, and you have not been given a PDF file.
>
>
> --
> View this message in context:
> http://www.nabble.com/asserting-PDF-responses--tp16863041p24521998.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>