cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@upaya.co.uk>
Subject Re: Unit testing pipelines?
Date Mon, 29 Sep 2003 18:36:19 GMT
Steve K wrote:

> Upayavira --
>
>> So, a UnitTestingPipeline in combination with extensions to the 
>> CLI/Bean to be able to configure this pipeline, wouldn't be too hard 
>> to implement. Are you interested?
>
>
> That is an angle I had not considered -- it does provide a flexible 
> way to test not only the end result, but also the intermediate steps 
> of a pipeline.  My only concern would be that using a different 
> pipeline may taint the testing process as you wouldn't use the 
> UnitTestingPipeline in a live application.
>
> When I was first thinking about this, I was imagining testing short 
> internal-only pipelines -- the types of pipelines that would be 
> aggregated in other pipelines.  For example, just testing the result 
> of a FileGenerator + SQLTransformer pipeline.  In contrast, testing 
> the result of complete pipelines seems best handled by existing tools 
> such as HTTPUnit, Cactus, or the anteater scripts that Vadim pointed 
> out to me. 

I think the bit that Vadim didn't perhaps mention is that you could use 
something like HTTPUnit with cocoon views, thus getting at the content 
at a certain point in a pipeline. You could even build views that have 
transformations to simplify this XML, so that when you get XML out of 
your view, you can do an identity comparision with your expected XML.

That way you could do 'unit testing' of pipeline stages with a 
functional testing tool such as HTTPUnit or Anteater, just using cocoon 
views when generating the page.

> Since I'm still a few days away from actually writing pipelines for my 
> application, it is hard for me to say which style of testing would be 
> most useful.  I plan on isolating all my logic in flow (that calls 
> other components) and using the pipelines strictly for gathering xml 
> and transforming it for display.
>
> Do you feel the CocoonBean could be modified to grab the output from 
> the short, internal only type pipelines that I described?  

The challenge would be how to link a particular XML that has been 
'intercepted' within a pipeline with an expected XML. How do you 
'annotate' a pipeline to identify what XMLs you're expecting? If you can 
just say:
<generator-xml src="..."/>
<transformer-xml src=".../"/>
<transformer-xml src=".../"/>
<transformer-xml src=".../"/>
<serializer-xml src=".../"/>

It might work, but how would you deal with aggregation, etc. I suspect 
that building the pipeline wouldn't be too hard, but working out how to 
build the configuration side of things would be quite a challenge.

> I imagine I'd have to expose those internal pipelines to the outside 
> somehow... 

See above stuff on views.

> perhaps your solution would be the easiest.  

Not sure. I'd try anteater and view first.

> Maybe when I reach the point where I need something I'll to cobble 
> together a UnitTestingPipeline.

I'd be interested to see it if you do!

Regards, Upayavira



Mime
View raw message