Archive for the ‘ZeeUnit Bugs’ Category

The finishedRun message follows the same pattern as TestSuite>>aboutToRun, is broken in the same way, and requires the same fix.

This bug also demonstrates that a test case is missing from ZeeTestTest (and, for that matter, from the original Smalltalk unit test test). The test case needs to be created and the bug repaired.

At a meta-level, it seems clear enough that these two bugs are really ONE bug with two symptoms. This, in turn, suggests additional required functionality in the Zeetix environment. It should be possible to express the relationship between these “two” bugs, so that it can be fixed “once and only once”.

At a deeper level, TestSuite>>aboutToRun and TestSuite>>finishedRun are two applications of the same underlying code pattern. That pattern originally delegated each to the clazz. Instead, it should have delegated each to a (missing) enumeration of the contents of the receiver.

This deeper relationship between these two apparently (from the source code) unrelated methods cannot be expressed in a notation-driven environment. This inability demonstrates why the Zeetix approach is needed.

Problem Code

The broken code is the implementation of the instance method (finishedRun) of TestSuite. The current Python implementation (transliterated from Smalltalk) is:

The aboutToRun message is supposed to be sent to each testCase before it runs. The implementation, inherited from SUnit, instead sends aboutToRun to each descendant of TestCase. This is particularly problematic when a descendant of TestSuite is created and instantiated — it initiates a circular reference and fails.

This bug demonstrates that a test case is missing from ZeeTestTest (and, for that matter, from the original Smalltalk unit test test). The test case needs to be created and the bug repaired.

Problem Code

The broken code is the implementation of the instance method (aboutToRun) of TestSuite. The current Python implementation (transliterated from Smalltalk) is:

clazz TestSuite:
#...
def aboutToRun(self):
self.clazz().aboutToRun()

This should be replaced with an implementation that enumerates all tests contained in the receiver and sends aboutToRun to each. In Smalltalk, this would read something like the following:

TestSuite>>aboutToRun
self allTestCases do: [each | each aboutToRun]

The allTestCases method does not currently exist and needs to be created.To Do