You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcial Rosales <ma...@spectel.com> on 2004/08/09 18:46:18 UTC

Re: Best approach for Unit Testing your Cocoon Application

	Hi all, I am struggling trying to write unit tests for my cocoon application. 
	
	I wrote an ActionTestCase class that extends the TestCase class from JUnit. This class facilitates the creation of the object model associated to a request (Request, Session, Context, action's parameters). Then, I can run an action using the previously created object model. 
	This works fine when you need to test individual actions. I don't have any problem to mock up the whole environment.

	However, when you start dealing with action-sets, whereby you invoke a form loading action, then, a form validation action, then the business logic action; I need to extend my ActionTestCase to handle action-set. At the end, I end up building up a cocoon framework. I don't think this is correct. 

	I am not using frameworks like HttpUnit because I need an instance of tomcat/cocoon, and this is was slows down the development cycle. I would like to be able to write some test, write some code in the action, and test through the sitemap; so that I know that everything has been testing in the pipeline.

	I hope somebody can give me some insights. 

	Regards

	Marcial

Re: Best approach for Unit Testing your Cocoon Application

Posted by Ralph Goers <Ra...@dslextreme.com>.
You should use the SitemapComponentTestCase.

At 8/9/2004  09:46 AM, you wrote:

>         Hi all, I am struggling trying to write unit tests for my cocoon 
> application.
>
>         I wrote an ActionTestCase class that extends the TestCase class 
> from JUnit. This class facilitates the creation of the object model 
> associated to a request (Request, Session, Context, action's parameters). 
> Then, I can run an action using the previously created object model.
>
>         This works fine when you need to test individual actions. I don't 
> have any problem to mock up the whole environment.
>
>         However, when you start dealing with action-sets, whereby you 
> invoke a form loading action, then, a form validation action, then the 
> business logic action; I need to extend my ActionTestCase to handle 
> action-set. At the end, I end up building up a cocoon framework. I don't 
> think this is correct.
>
>         I am not using frameworks like HttpUnit because I need an 
> instance of tomcat/cocoon, and this is was slows down the development 
> cycle. I would like to be able to write some test, write some code in the 
> action, and test through the sitemap; so that I know that everything has 
> been testing in the pipeline.
>
>         I hope somebody can give me some insights.
>
>         Regards
>
>         Marcial