Of course that's not unit testing :-) > -----Original Message----- > From: Hani Suleiman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 17, 2004 10:27 PM > To: [EMAIL PROTECTED] > Subject: Re: [OS-webwork] Unit-testing actions in WW1.3 > > > Why not just use GenericDispatcher? You should be able to set up your > environment programatically and make sure everything is populated > correctly in your ActionContext (given of course that you avoid all > web-specific calls). Have a look at ServletDispatcher, you'll > see that > all it is is a wrapper around GenericDispatcher that does > web-specific > setup (eg, set params based on request, handle multipart stuff, etc). > > On Feb 17, 2004, at 9:45 AM, Jason Carreira wrote: > > > You could try refactoring your base Action class to use Dependency > > Injection with a container like Spring (there's docs on > using Spring > > with WW1.x on the Wiki). Then, to unit test, you could just > create a > > Mock DataSource, etc.. > > > > Otherwise, you'll need to manage ActionContext scopes > yourself, in the > > setUp() and tearDown() methods. This is doable (we do it in the WW2 > > unit > > tests) but it's error prone, so avoid it if possible. > > > > Jason > > > >> -----Original Message----- > >> From: James Pan [mailto:[EMAIL PROTECTED] > >> Sent: Tuesday, February 17, 2004 9:34 AM > >> To: [EMAIL PROTECTED] > >> Subject: [OS-webwork] Unit-testing actions in WW1.3 > >> > >> > >> Hi, > >> > >> I have a base class from which all my actions extend. This > base class > >> uses ActionContext to read properties file, initialize database > >> connections, and so on. > >> > >> Now, when I create a new action, how can I unit-test it? I haven't > >> tried it because the idea seems absurd to me, but do I > need to have > >> some sort of webwork framework running somewhere in order > to do this? > >> How do I retrieve the context to read the properties file? > What else > >> should I be aware of?? > >> > >> I'm sorry. I have no clue. Please help! Thank you!! > >> > >> James > >> > >> > >> ------------------------------------------------------- > >> SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and > >> deploy apps & Web services for Linux with a free DVD software kit > >> from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438> > >> &op=ick > >> > >> _______________________________________________ > >> > >> Opensymphony-webwork mailing list > >> [EMAIL PROTECTED] > >> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > >> > > > > > > ------------------------------------------------------- > > SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and > > deploy apps & Web services for Linux with a free DVD > software kit from > > IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=click > > _______________________________________________ > > Opensymphony-webwork mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id56&alloc_id438> &op=ick > > _______________________________________________ > > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >
------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=click _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork