You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stefan Klein <kl...@web.de> on 2005/10/26 10:34:29 UTC
unittesting flow
Hi,
I was wondering if someone has got a hint on how to unittest flow
(javaflow in my case, but I guess it'd be the same for any flow). I
searched the wiki and the archives without luck.
I saw the callFunction-method in SitemapComponentTestcase which looks
like what I want, but couldn't get it to work. I have used
SitemapComponentTestcase to unittest generators before, so I think I
know what I am doing. I created my .xtest-file, added the flow-
interpreters role (copied from cocoon.roles) and added a component-
instance for JavaInterpreter. Still I get an exception "Could not
retrieve interpreter..." when I call callFunction with type "java".
Debugging I find that indeed the interpreter-selector doesn't contain
the JavaInterpreter.
Am I missing something? It'd be great to get a working example of how
to use callFunction or at least a short comment on what the
parameters are and what needs to be added to .xtest, just to make
sure I am not overlooking something.
Or if someone has got a different way of unittesting flow I'd be very
happy to hear it. I am going to use flow extensively in my project
and I want to make sure I can test it properly. HTTP-testing, as has
been suggested before on the list, doesn't go deep enough.
Thanks a lot for any help!
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: unittesting flow
Posted by Torsten Curdt <tc...@apache.org>.
> I was wondering if someone has got a hint on how to unittest flow
> (javaflow in my case, but I guess it'd be the same for any flow). I
> searched the wiki and the archives without luck.
What cocoon version are you talking about?
> I saw the callFunction-method in SitemapComponentTestcase which
> looks like what I want, but couldn't get it to work. I have used
> SitemapComponentTestcase to unittest generators before, so I think
> I know what I am doing. I created my .xtest-file, added the flow-
> interpreters role (copied from cocoon.roles) and added a component-
> instance for JavaInterpreter. Still I get an exception "Could not
> retrieve interpreter..." when I call callFunction with type "java".
> Debugging I find that indeed the interpreter-selector doesn't
> contain the JavaInterpreter.
On a first glance the way you are doing it sounds ok.
> Am I missing something? It'd be great to get a working example of
> how to use callFunction or at least a short comment on what the
> parameters are and what needs to be added to .xtest, just to make
> sure I am not overlooking something.
* @param funName a <code>String</code> value, the name of the
* function to call
* @param params a <code>List</code> object whose components are
* CallFunctionNode.Argument instances. The interpretation of the
* parameters is left to the actual implementation of the
* interpreter.
* @param redirector a <code>Redirector</code> used to call views
*/
void callFunction(String funName, List params, Redirector
redirector)
throws Exception;
Or what do you mean?
> Or if someone has got a different way of unittesting flow I'd be
> very happy to hear it. I am going to use flow extensively in my
> project and I want to make sure I can test it properly. HTTP-
> testing, as has been suggested before on the list, doesn't go deep
> enough.
Again the user and sitemap interaction part is hard to test via junit.
How deep would you like to test? Could you come up with an example?
cheers
--
Torsten