> Here is a scenario for which I would like advice:
> Suppose I have got a system composed of these packages:
> Business Logic
> How would I go about writing a Smalltalk script to run in a workspace
> that would:
> 1. Run the tests.
> 2. If the tests pass, export the packages to some location.
> 3. Optionally, export them even if the tests fail.
The methods below might help. I use #prod: to put test-running comments
in most of my test cases, something like
where #prod: is silent on success and raises a walkback on failure.
When I want to verify that all is well, I use the SUnitBrowser; when I
know there is a problem (or even have good reason to suspect so), I
browse the method and use the #prod: line to skip selection steps and
move directly to a walkback.
Something along the lines of
"tests go here, using variant on #runTestsReferencing:"
] on:Error do:[ :e |
( MessageBox confirm:'Save packages after test failure(s)?' ) ifTrue:[
"Save to alternate location"
Clearly the above is pseudo code, and as such, has never been run, let
alone debugged. The methods below are part of my arsenal and should
work as advertised (but not warrantied<g>).
Caveat: you might need to use #ifCurtailed: vs. #on:do:. Start small
and safe and work your way up to what you want.
Have a good one,
!TestCase class methodsFor!
"Run the test; do nothing if ok or go to a walkback."