You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Miguel Almeida <mi...@almeida.at> on 2012/05/14 11:15:48 UTC

Does the StrutsTestCase test filters defined in web.xml?

Dear all,

I am using StrutsSpringTestCase (which extends StrutsTestCase) to
perform some acceptance tests (under the skin). I am also using
Displaytag (www.displaytag.org/1.2/ ) to build some tables in the view.
This tag supports excel/pdf export, which uses a filter you configure in
web.xml [1]

The way the filter works is, in short: a (odd looking, numerical)
parameter is added to the request. The filter checks for the existence
of that parameter and, if it exists, creates the pdf/excel. 

I want to test the creation of this file (and its contents). However,
when I debug the StrutsSpringTestCase test with a breakpoint on that
filter it does not stop there, so my questions are:

1) Does the StrutsTestCase not pass through other filters in your
web.xml, and only goes through the struts filter?
2) If so, is there anything else in the struts tests that could help me
out? How do you suggest I perform this test?
 
Thank you,

Miguel Almeida



[1]- see http://www.displaytag.org/1.2/export_filter.html 

Re: Does the StrutsTestCase test filters defined in web.xml?

Posted by "J. Garcia" <jo...@gmail.com>.
I recommend you use canoo webtest. This is not a unit test tool, but
integration test tool.
This is the tool used for instance in AppFuse. It has specific pdf
verification steps.

Cheers,
J.

On Mon, May 14, 2012 at 5:33 PM, Miguel Almeida <mi...@almeida.at> wrote:

> Hi Steve,
>
> On Mon, 2012-05-14 at 11:09 +0100, Steve Higham wrote:
>
> > Hi Miguel,
> >
> > I haven't used the StrutsSpringTestCase however I have made use of the
> StrutsTestCase.
> >
> > This only tests the interceptor stack / Action / Result. There is no web
> server involved and no attempt to render the resulting page.
>
> Yes, that's what I thought.
>
> > You could try looking at Apache Cactus or Apache HttpClient to test this
> behaviour? Alternatively if you generate the file within Struts then the
> StrutsTestCase will suffice. I've generated exports from Struts this way.
> >
>
> Both are no longer maintained (I guess httpclient got replaced with
> Apache http components (http://hc.apache.org/ ) but I haven't explored
> this yet.
>
> For this case (testing the pdf output created by the displaytag) I don't
> think it'll be worth it to invest in a new testing setup: this is the
> only thing that is produced outside the scope of struts and a manual
> inspection might suffice.
>
> However, I do want to explore other tools that are available to test the
> http request/response, so I'll look into this further.
>
> Cheers,
>
> Miguel Almeida
>
> > Cheers,
> >
> > Steve
> >
> > -----Original Message-----
> > From: Miguel Almeida [mailto:miguel@almeida.at]
> > Sent: 14 May 2012 10:16
> > To: user@struts.apache.org
> > Subject: Does the StrutsTestCase test filters defined in web.xml?
> >
> > Dear all,
> >
> > I am using StrutsSpringTestCase (which extends StrutsTestCase) to
> perform some acceptance tests (under the skin). I am also using Displaytag (
> www.displaytag.org/1.2/ ) to build some tables in the view.
> > This tag supports excel/pdf export, which uses a filter you configure in
> web.xml [1]
> >
> > The way the filter works is, in short: a (odd looking, numerical)
> parameter is added to the request. The filter checks for the existence of
> that parameter and, if it exists, creates the pdf/excel.
> >
> > I want to test the creation of this file (and its contents). However,
> when I debug the StrutsSpringTestCase test with a breakpoint on that filter
> it does not stop there, so my questions are:
> >
> > 1) Does the StrutsTestCase not pass through other filters in your
> web.xml, and only goes through the struts filter?
> > 2) If so, is there anything else in the struts tests that could help me
> out? How do you suggest I perform this test?
> >
> > Thank you,
> >
> > Miguel Almeida
> >
> >
> >
> > [1]- see http://www.displaytag.org/1.2/export_filter.html
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
>
>

Re: Does the StrutsTestCase test filters defined in web.xml?

Posted by Łukasz Lenart <lu...@googlemail.com>.
You can try to use Jetty as an embedded server, take a look on
BasePortletTest in Portlet Plugin


Regards
-- 
Łukasz http://www.lenart.org.pl/
mobile +48 606 323 122, office +27 11 0838747
Warszawa JUG conference - Confitura http://confitura.pl/

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


RE: Does the StrutsTestCase test filters defined in web.xml?

Posted by Miguel Almeida <mi...@almeida.at>.
Hi Steve, 

On Mon, 2012-05-14 at 11:09 +0100, Steve Higham wrote:

> Hi Miguel,
> 
> I haven't used the StrutsSpringTestCase however I have made use of the StrutsTestCase.
> 
> This only tests the interceptor stack / Action / Result. There is no web server involved and no attempt to render the resulting page.

Yes, that's what I thought. 

> You could try looking at Apache Cactus or Apache HttpClient to test this behaviour? Alternatively if you generate the file within Struts then the StrutsTestCase will suffice. I've generated exports from Struts this way.
> 

Both are no longer maintained (I guess httpclient got replaced with
Apache http components (http://hc.apache.org/ ) but I haven't explored
this yet. 

For this case (testing the pdf output created by the displaytag) I don't
think it'll be worth it to invest in a new testing setup: this is the
only thing that is produced outside the scope of struts and a manual
inspection might suffice.

However, I do want to explore other tools that are available to test the
http request/response, so I'll look into this further.

Cheers,

Miguel Almeida

> Cheers,
> 
> Steve
> 
> -----Original Message-----
> From: Miguel Almeida [mailto:miguel@almeida.at] 
> Sent: 14 May 2012 10:16
> To: user@struts.apache.org
> Subject: Does the StrutsTestCase test filters defined in web.xml?
> 
> Dear all,
> 
> I am using StrutsSpringTestCase (which extends StrutsTestCase) to perform some acceptance tests (under the skin). I am also using Displaytag (www.displaytag.org/1.2/ ) to build some tables in the view.
> This tag supports excel/pdf export, which uses a filter you configure in web.xml [1]
> 
> The way the filter works is, in short: a (odd looking, numerical) parameter is added to the request. The filter checks for the existence of that parameter and, if it exists, creates the pdf/excel. 
> 
> I want to test the creation of this file (and its contents). However, when I debug the StrutsSpringTestCase test with a breakpoint on that filter it does not stop there, so my questions are:
> 
> 1) Does the StrutsTestCase not pass through other filters in your web.xml, and only goes through the struts filter?
> 2) If so, is there anything else in the struts tests that could help me out? How do you suggest I perform this test?
>  
> Thank you,
> 
> Miguel Almeida
> 
> 
> 
> [1]- see http://www.displaytag.org/1.2/export_filter.html 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



RE: Does the StrutsTestCase test filters defined in web.xml?

Posted by Steve Higham <st...@sjlt.co.uk>.
Hi Miguel,

I haven't used the StrutsSpringTestCase however I have made use of the StrutsTestCase.

This only tests the interceptor stack / Action / Result. There is no web server involved and no attempt to render the resulting page. Therefore I would be surprised if anything from web.xml is called.

You could try looking at Apache Cactus or Apache HttpClient to test this behaviour? Alternatively if you generate the file within Struts then the StrutsTestCase will suffice. I've generated exports from Struts this way.

Cheers,

Steve

-----Original Message-----
From: Miguel Almeida [mailto:miguel@almeida.at] 
Sent: 14 May 2012 10:16
To: user@struts.apache.org
Subject: Does the StrutsTestCase test filters defined in web.xml?

Dear all,

I am using StrutsSpringTestCase (which extends StrutsTestCase) to perform some acceptance tests (under the skin). I am also using Displaytag (www.displaytag.org/1.2/ ) to build some tables in the view.
This tag supports excel/pdf export, which uses a filter you configure in web.xml [1]

The way the filter works is, in short: a (odd looking, numerical) parameter is added to the request. The filter checks for the existence of that parameter and, if it exists, creates the pdf/excel. 

I want to test the creation of this file (and its contents). However, when I debug the StrutsSpringTestCase test with a breakpoint on that filter it does not stop there, so my questions are:

1) Does the StrutsTestCase not pass through other filters in your web.xml, and only goes through the struts filter?
2) If so, is there anything else in the struts tests that could help me out? How do you suggest I perform this test?
 
Thank you,

Miguel Almeida



[1]- see http://www.displaytag.org/1.2/export_filter.html 


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