• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOUnitTest pattern?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOUnitTest pattern?


  • Subject: Re: WOUnitTest pattern?
  • From: shaun <email@hidden>
  • Date: Sun, 14 May 2006 01:44:10 +0930

Hi, Wolfram, Anjo,

On Sat, 2006-05-13 at 16:54 +0200, Anjo Krank wrote:
> OTTOMH, either move the actual methods to test elsewhere ie, don't do
> nextPage.setValue(context().stringFormValueForKey("foo")) but instead
> create a method that takes all needed info as parameters and test
> this, or (preferably) create a request with the URL parameters you
> want and create the DA manually, then call the methods you want to test.

Or, use composition rather than sticking all the functional code inside
the direct action method or class. eg)

public WOActionResults myAction(){
   String a,b,c;
   a = formValueForKey("a");
   b = formValueForKey("b");
   c = formValueForKey("c");

   LogicObject lo = LogicObject.newInstance(a,b,c);
   lo.myAction();

   CustomPage p = (CustomPate) lo.ok() ?
          pageWithName("CustomPageOK") :
          pageWithName("CustomPageNotOk");
   p.setLogicObject(lo);

   return (WOActionResults)p;
}

Now you simply test the LogicObject's functionality not the DA.

regards,
 - shaun

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >WOUnitTest pattern? (From: Wolfram Stebel <email@hidden>)
 >Re: WOUnitTest pattern? (From: Anjo Krank <email@hidden>)

  • Prev by Date: Re: WOUnitTest for relations
  • Next by Date: Re: WOUnitTest pattern?
  • Previous by thread: Re: WOUnitTest pattern?
  • Next by thread: Re: WOUnitTest pattern?
  • Index(es):
    • Date
    • Thread