Re: WOUnitTest pattern?
Re: WOUnitTest pattern?
- Subject: Re: WOUnitTest pattern?
- From: Anjo Krank <email@hidden>
- Date: Sat, 13 May 2006 18:57:59 +0200
Am 13.05.2006 um 17:36 schrieb Wolfram Stebel:
Am 13.05.2006 16:54 Uhr schrieb "Anjo Krank" unter
<email@hidden>:
I intended to create requests and execute them.
But i dont know how...
pseudo code:
Reading the docs should help...
WORequest r = new WORequest(url, httpVersion,headers, content,
userInfo);
sth like:
WORequest r = new WORequest("/cgi-bin/WebObjects/MyApp.woa/wa/
MyTestActionClass/myAction?key=val1", "HTTP/1.0", new NSDictionary
("somewhere.com", "host"), new NSData("Some Content".getBytes()),
nulll);
(I haven't tested this, nor read the docs, it should still work,
though :)
It would greatly depend on your DAs (eg if they need a session etc)
if you can really test them in a meaningful way, though... just out
of curiosity, what *would* you want to test? I can hardly imagine
what I had in a DA, short of if the parameter names were spelled
correctly that would make a meaningful test.
- Most important to test that programm changes simply have the same
result
afterwards
And just how would you check this? You'll normally get back an
WOActionResults, that does plain nothing except generate the response...
- Second to test variants of calls
- Third to test correct parameter supply
- Fourth to simplify testing of a set of DirectActions
- Fifth to test the robustnes of DA's to wrong input (When someone
creates
it's DA-calls manually)
Am i wrong?
Dunno... just go ahead and tell me how it works :)
Having said this, I *am* using DAs quite successfully to test my D2W
apps. together with the ERD2WDirectAction, you can create URLs like
/cgi-bin/WebObjects/MyApp.woa/wa/CreateFoo
and if you call appendtoResponse on this, you can see quite a lot of
errors if you haven't set up your rules correctly. You can simply
check these by looking for typical Strings like "Error" or
"Exception" and so on. you might also improve on that by supplying
known keys and calling a known action on a page. I have not see the
need so far, tough, as my apps are naturally brilliant and without
any errors :)
But here I'm using DAs as a mean for testing, not and end.
Cheers, Anjo
_______________________________________________
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