Hi to all!

I’m new to cocoon and I’m trying to find the ways to do unit testing on my cocoon project.

I found how to test a single component (generator,matcher,action and selector) with SitemapComponentTestCase.

I also found how to test the webapp with HtmlUnitTestCase.

I’m now trying to find how to test a single pipeline without using HtmlUnit. The requirement to use HtmlUnit is to have a webapp up and running in an application/servlet container. I would like to test a pipeline without doing any deploy of the webapp. What  I need is a testing framework that create a mock cocoon context in which I can run my pipeline, so if I have this sample sitemap:

 

 

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0" xmlns:xmlvs="http://pro-netics.com/xmlvs/1.0">

  <map:pipelines>

    <map:pipeline>  

            <map:match pattern="file/**”>

                                               …

            </map:match>                         

     </map:pipeline>

  </map:pipelines>

</map:sitemap>

 

 

I would like to write a unit test like this:

 

public class SamplePipelineTest extends MockCocoonContextTestSuite{

           

            private expectedFilePipelineOutput = “”;

 

            public void setUp(){

                        // set up mock cocoon context

                        …

            }

           

            public void testFilePipeline(){

           

                        String cocoonUrl=”cocoon:/file/xxx”;

                        Parameters parameters = ….

                        cocoonContest.loadUrl(cocoonURL,parameters,….);

                        assertCocoonPipelineOutput(expectedFilePipelineOutput);

 

            }

 

}

 

 

My question is: does anybody knows if it’s possible and how to do this kind of test?

 

 

Thank you and bye!

Roberto Manicardi

 

 

Reply via email to