ASTest redux
ASTest redux
- Subject: ASTest redux
- From: has <email@hidden>
- Date: Fri, 27 Sep 2002 22:46:07 +0100
Hi,
Just wondering if anyone has any thoughts on ASTest yet? I know this topic
isn't most folks' cup of tea, but _somebody's_ certainly been hitting the
ASTest download, and I think perhaps they've come over all shy since...;)
Really, _all_ feedback is welcome - even to say it made absolutely no sense
whatsoever. That is also helpful, and if that's the truth then I want to
hear it.
--
Anyway, now that I'm online again I've bee doing some more reading [v0.2
was written 150 miles from my modem point, unfortunately, so I couldn't do
any research:]. And I'm feeling increasingly discontented with what I've
got so far, especially the only-one-test-per-testCase limitation which is a
real drag. i.e. The usual approach with xUnit-style frameworks [the
standard model] is to have several tests grouped together per test case,
with each test written as a custom-named handler. This is somewhat simpler
and _way_ less verbose than what I've currently got, and in AS would look
like:
script |tests for squareOf()|
property parent : testCase()
on |check for valid results test|()
--test code
end |check for valid results|
on |errors with invalid data test|()
--test code
end |check error thrown for invalid data|
end script
Looks very nice. Unfortunately, AS doesn't support introspection, so
there's no way to automatically suck up the names of those test handlers in
order to call them later. [And decompiling the script and running regexps
on it to find them is way, way to kludgy and 3rd-party dependent for my
tastes.]
But instead I've come up with the following idea, which I'm pretty sure can
work:
======================================================================
script |tests for squareOf()|
property parent : testCase(me)
on testHandler(n)
testScript()'s squareOf(n)
end testHandler
on runTests()
script |check for valid results|
property parent : test(me)
--test code
assertEqual(1, 1)
assertEqual(2, 4)
...
end script
script |errors with invalid data|
property parent : test(me)
--test code
assertError(false, 3268)
end script
end runTests
end script
======================================================================
Instead of defining each test as a handler, they're individual script
objects which are then wrapped in a single 'runTests()' handler. Still a
fairly atypical approach (though at the end of the day constructing the
outline is no more than drag-n-drop anyway), but much more concise.
Now, I think it's pretty understandable, but then I'm biased. So I'd like
to hear what other folks think. (Don't worry, I won't bite.)
--
Oh, and if anyone has any ideas what I might do to compensate for AS's
stupid treatment of reals, eg:
0.7 * 0.7 = 0.49
--> false
as well as suggestions for extra checking I can include [TIDs and
considering/ignoring are done, but there's bound to be others I've not
considered] I'd be muchly grateful.
Thanks,
has
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.