Bug fixes and test framework changes

Tim Moore Timothy at Moore.name
Sat Feb 7 17:16:57 PST 2004


I've spent a little bit of time getting all of the tests to run 
successfully, and played with some ideas for fleshing out the framework 
going forward.

Overview of the changes:
  - condition-epilogue.slate had a little typo that was causing one of 
the dictionary tests to fail
  - test.slate had a call to "TestFailure newWith: descr" that should 
have been updated to use newDescription:. It also called clone 
somewhere that it probably should be calling copy, and called exit: in 
a couple places without specifying the initial parameter (which should 
be a Condition)
  - dictionary.test referred to "Collection CollectionIsEmpty", which 
has been changed to "Collection IsEmpty"
  - test.test had a test that always signaled an error. I believe it 
should be commented out by default, as some of the other test cases in 
that file are already

I also want to establish a better convention for running all of the 
tests in a module. Currently, most of the test files define a testSuite 
method that does that, but this is less than ideal for a couple of 
reasons. By convention in most xUnit based frameworks, all methods that 
begin with 'test' are test case methods. For these purposes, the 
testSuite methods are not. Further confusing the issue, test.test has 
had a testSuite method all along that *is* a test case (that tests 
suites, natch). SUnit and relatives define a "suite" method on TestCase 
that returns a suite of all of the test cases defined on the class, 
which you can then run or include in another suite. I think that's a 
fine model to follow, so I've changed all of the testSuite methods in 
the various modules appropriately (and added a new suite method to 
test.test). As a bit of sugaring, I added a runSuite method on 
TestCases that just calls 'suite run' on its argument.

In SUnit, the suite method, rather than having to be re-defined by each 
TestCase implementation, introspectively gathers all of the methods 
that start with 'test'. I'll probably add something like that in the 
near future.

I'm also including a file called init-tests.slate that I wrote to make 
my life a little easier. It loads in test.slate and then all of the 
test files (except matrix.test, which I left out because matrix.slate 
isn't loaded by init.slate). I did this so I could just fileIn 
init.slate and init-tests.slate in turn and have my environment set up 
for working with the tests. I don't know whether anyone's interested in 
including this in the main distro or not.

One other thing that it does is create a suite at Tests All that 
contains all of the suites that it loads in. So I can run everything 
from test.test, dictionary.test, and numeric.test all at once just by 
calling "Tests All run". It may actually make more sense to set up 
Tests All in test.slate, and then have each test module register itself 
in there. I'll leave that up to the committers.
-- 
Tim Moore

-------------- next part --------------
A non-text attachment was scrubbed...
Name: condition-epilogue.slate.diff
Type: application/octet-stream
Size: 322 bytes
Desc: not available
Url : /archives/slate/attachments/20040207/42f92882/condition-epilogue.slate.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dictionary.test.diff
Type: application/octet-stream
Size: 555 bytes
Desc: not available
Url : /archives/slate/attachments/20040207/42f92882/dictionary.test.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init-tests.slate
Type: application/octet-stream
Size: 340 bytes
Desc: not available
Url : /archives/slate/attachments/20040207/42f92882/init-tests.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matrix.test.diff
Type: application/octet-stream
Size: 359 bytes
Desc: not available
Url : /archives/slate/attachments/20040207/42f92882/matrix.test.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: numeric.test.diff
Type: application/octet-stream
Size: 361 bytes
Desc: not available
Url : /archives/slate/attachments/20040207/42f92882/numeric.test.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.slate.diff
Type: application/octet-stream
Size: 585 bytes
Desc: not available
Url : /archives/slate/attachments/20040207/42f92882/test.slate.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.test.diff
Type: application/octet-stream
Size: 1102 bytes
Desc: not available
Url : /archives/slate/attachments/20040207/42f92882/test.test.obj
-------------- next part --------------



More information about the Slate mailing list