Hello everyone --

I am currently building a Cocoon application and so far I've extended the ExcaliburTestCase class to write my JUnit tests for the components I'm creating. However, I'm now at the point where I am starting to write pipelines that generate XML based on the database manipulations the previously mentioned components perform, and it appears that there is no easy way to test these. For example, my ideal test code might look like:

myCustomComponent.doSomething();
Document actualXml = cocoon.process("/path/to/my/pipeline");
Diff diff = new Diff(actualXml, expectedXml);
assertTrue("pipeline test", diff.identical());

I suppose I could use something like HTTPUnit here, and set up a test script to start cocoon, request the uri and parse the result into XML... but that seems a little messier than it should be.

I've looked at the CocoonBean stuff, and while it is close, it seems geared toward publishing pages rather than embedding cocoon and directly calling pipelines.

Does this sound like a good idea, or is everyone just using HTTPUnit for this level of testing? Might it be possible to modify CocoonBean to allow direct access to the result of calling a pipeline? Does anyone think unit testing pipelines this way is actually valuable?

thanks for any advice,
-steve




Reply via email to