You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by da...@sybase.com on 2008/04/23 21:12:17 UTC

asserting PDF responses?

Hello, does anyone have a suggestion on how to assert a valid response when
the response is not text or xml, but instead the content type used for
iText generated PDF documents, "application/pdf"?  Thank you in advance.

David Brooks


---------------------------------------------------------------------
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
>
>

Re: asserting PDF responses?

Posted by blackgaff <jo...@gmail.com>.
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 Manjula Priyantha <ma...@ebuilder.lk>.
Thx Sebb & Thomas. I got all your points.

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Thursday, February 26, 2009 6:47 PM
To: JMeter Users List
Subject: Re: asserting PDF responses?

Or you can use "Save Responses to a file" for each of the PDF
downloads and check the files later using a PDF reader.

PDF files are also likely to be bigger than HTML files, so you may be
able to use a size assertion.

On 26/02/2009, Thomas Johnson <nt...@gmail.com> wrote:
> 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.
>
>
>  On Thu, Feb 26, 2009 at 12:26 PM, Manjula Priyantha
>  <ma...@ebuilder.lk> wrote:
>  > Hi,
>  >
>  > I have the same requirement of asserting PDF response. Can someone pls.
help
>  > on this with an example (I didn't get the following solution)?
>  >
>  > BR,
>  > Manjula
>  >
>  > -----Original Message-----
>  > From: Kapil Khanna Avolent [mailto:kkhanna@avolent.com]
>  > Sent: Thursday, April 24, 2008 1:40 AM
>  > To: JMeter Users List
>  > Subject: RE: asserting PDF responses?
>  >
>  > You can use the following Pattern to Test using Response Assertion for
>  > pdf docs
>  >
>  > %PDF-1.4
>  >
>  > -----Original Message-----
>  > From: david.brooks@sybase.com [mailto:david.brooks@sybase.com]
>  > Sent: Wednesday, April 23, 2008 12:12 PM
>  > To: jmeter-user@jakarta.apache.org
>  > Subject: asserting PDF responses?
>  >
>  >
>  > Hello, does anyone have a suggestion on how to assert a valid response
>  > when the response is not text or xml, but instead the content type used
>  > for iText generated PDF documents, "application/pdf"?  Thank you in
>  > advance.
>  >
>  > David Brooks
>  >
>  >
>  > ---------------------------------------------------------------------
>  > 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
>  >
>  > --------------------------------------------------------
>  > |This e-mail was scanned for viruses, spam and malware.|
>  > --------------------------------------------------------
>  >
>  > --------------------------------------------------------
>  > |This e-mail was scanned for viruses, spam and malware.|
>  > --------------------------------------------------------
>  >
>  > ---------------------------------------------------------------------
>  > 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


--------------------------------------------------------
|This e-mail was scanned for viruses, spam and malware.|
--------------------------------------------------------

---------------------------------------------------------------------
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 sebb <se...@gmail.com>.
Or you can use "Save Responses to a file" for each of the PDF
downloads and check the files later using a PDF reader.

PDF files are also likely to be bigger than HTML files, so you may be
able to use a size assertion.

On 26/02/2009, Thomas Johnson <nt...@gmail.com> wrote:
> 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.
>
>
>  On Thu, Feb 26, 2009 at 12:26 PM, Manjula Priyantha
>  <ma...@ebuilder.lk> wrote:
>  > Hi,
>  >
>  > I have the same requirement of asserting PDF response. Can someone pls. help
>  > on this with an example (I didn't get the following solution)?
>  >
>  > BR,
>  > Manjula
>  >
>  > -----Original Message-----
>  > From: Kapil Khanna Avolent [mailto:kkhanna@avolent.com]
>  > Sent: Thursday, April 24, 2008 1:40 AM
>  > To: JMeter Users List
>  > Subject: RE: asserting PDF responses?
>  >
>  > You can use the following Pattern to Test using Response Assertion for
>  > pdf docs
>  >
>  > %PDF-1.4
>  >
>  > -----Original Message-----
>  > From: david.brooks@sybase.com [mailto:david.brooks@sybase.com]
>  > Sent: Wednesday, April 23, 2008 12:12 PM
>  > To: jmeter-user@jakarta.apache.org
>  > Subject: asserting PDF responses?
>  >
>  >
>  > Hello, does anyone have a suggestion on how to assert a valid response
>  > when the response is not text or xml, but instead the content type used
>  > for iText generated PDF documents, "application/pdf"?  Thank you in
>  > advance.
>  >
>  > David Brooks
>  >
>  >
>  > ---------------------------------------------------------------------
>  > 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
>  >
>  > --------------------------------------------------------
>  > |This e-mail was scanned for viruses, spam and malware.|
>  > --------------------------------------------------------
>  >
>  > --------------------------------------------------------
>  > |This e-mail was scanned for viruses, spam and malware.|
>  > --------------------------------------------------------
>  >
>  > ---------------------------------------------------------------------
>  > 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


Re: asserting PDF responses?

Posted by Thomas Johnson <nt...@gmail.com>.
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.

On Thu, Feb 26, 2009 at 12:26 PM, Manjula Priyantha
<ma...@ebuilder.lk> wrote:
> Hi,
>
> I have the same requirement of asserting PDF response. Can someone pls. help
> on this with an example (I didn't get the following solution)?
>
> BR,
> Manjula
>
> -----Original Message-----
> From: Kapil Khanna Avolent [mailto:kkhanna@avolent.com]
> Sent: Thursday, April 24, 2008 1:40 AM
> To: JMeter Users List
> Subject: RE: asserting PDF responses?
>
> You can use the following Pattern to Test using Response Assertion for
> pdf docs
>
> %PDF-1.4
>
> -----Original Message-----
> From: david.brooks@sybase.com [mailto:david.brooks@sybase.com]
> Sent: Wednesday, April 23, 2008 12:12 PM
> To: jmeter-user@jakarta.apache.org
> Subject: asserting PDF responses?
>
>
> Hello, does anyone have a suggestion on how to assert a valid response
> when the response is not text or xml, but instead the content type used
> for iText generated PDF documents, "application/pdf"?  Thank you in
> advance.
>
> David Brooks
>
>
> ---------------------------------------------------------------------
> 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
>
> --------------------------------------------------------
> |This e-mail was scanned for viruses, spam and malware.|
> --------------------------------------------------------
>
> --------------------------------------------------------
> |This e-mail was scanned for viruses, spam and malware.|
> --------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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


RE: asserting PDF responses?

Posted by Manjula Priyantha <ma...@ebuilder.lk>.
Hi,

I have the same requirement of asserting PDF response. Can someone pls. help
on this with an example (I didn't get the following solution)?

BR,
Manjula

-----Original Message-----
From: Kapil Khanna Avolent [mailto:kkhanna@avolent.com] 
Sent: Thursday, April 24, 2008 1:40 AM
To: JMeter Users List
Subject: RE: asserting PDF responses?

You can use the following Pattern to Test using Response Assertion for
pdf docs

%PDF-1.4

-----Original Message-----
From: david.brooks@sybase.com [mailto:david.brooks@sybase.com] 
Sent: Wednesday, April 23, 2008 12:12 PM
To: jmeter-user@jakarta.apache.org
Subject: asserting PDF responses?


Hello, does anyone have a suggestion on how to assert a valid response
when the response is not text or xml, but instead the content type used
for iText generated PDF documents, "application/pdf"?  Thank you in
advance.

David Brooks


---------------------------------------------------------------------
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

--------------------------------------------------------
|This e-mail was scanned for viruses, spam and malware.|
--------------------------------------------------------

--------------------------------------------------------
|This e-mail was scanned for viruses, spam and malware.|
--------------------------------------------------------

---------------------------------------------------------------------
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 Kapil Khanna Avolent <kk...@avolent.com>.
You can use the following Pattern to Test using Response Assertion for
pdf docs

%PDF-1.4

-----Original Message-----
From: david.brooks@sybase.com [mailto:david.brooks@sybase.com] 
Sent: Wednesday, April 23, 2008 12:12 PM
To: jmeter-user@jakarta.apache.org
Subject: asserting PDF responses?


Hello, does anyone have a suggestion on how to assert a valid response
when the response is not text or xml, but instead the content type used
for iText generated PDF documents, "application/pdf"?  Thank you in
advance.

David Brooks


---------------------------------------------------------------------
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