unittesting flow

2005-10-26 Thread Stefan Klein

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: unittesting flow

2005-10-26 Thread Torsten Curdt
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 String value, the name of the
 * function to call
 * @param params a List object whose components are
 * CallFunctionNode.Argument instances. The interpretation of the
 * parameters is left to the actual implementation of the
 * interpreter.
 * @param redirector a Redirector 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



PGP.sig
Description: This is a digitally signed message part