Archive for the ‘ZeeTest Changes’ Category

TestSuiteTestCase added to ZeeTestTest

February 8, 2009

The new ZeeSuiteTestCase demonstrates the aboutToRun and finishedRun bugs that I found in the original SUnit, and therefore ZeeUnit, test suite.

Interestingly, it demonstrates the utility of clazz instance variables. In this case, a message (aboutToRun and finishedRun) was being sent to all descendants of TestCase instead of just the TestCase descendants whose instances were contained inĀ  whatever TestSuite instance was being run.

I created a descendant — CountingTestCase — that contains two clazz instance variables (“ranAboutToRun” and “ranFinishedRun”). It hooks the aboutToRun and finishedRun clazz methods and, within each, sets the corresponding clazz instance variable before delegating to its superclazz (TestCase). It also contains a trivial instance method, “dummy”, that TestSuiteTestCase uses to instantiate test instances. I then created two descendants of CountingTestCase — “ShouldNotRunTestCase” and “ShouldRunTestCase”.

The tests within TestSuiteTestCase (there are currently four of them, two each for aboutToRun and finishedRun) create a new TestSuite and add an instance of ShouldRunTestCase that invokes the “dummy” test method. It then asserts that the ShouldRunTestCase clazz method was run and denies that the ShouldNotRunTestCase clazz method was run.

The initial version of ZeeTest (and SUnit) fails this test.

I then modified the aboutToRun and finishedRun instance methods of TestSuite to fix the problem (see the “Python closures and collections are broken” flame for more).

I then committed and pushed the new code to the git repository.

Now that this ZeeTest bug is fixed, I can resume working on the KernelTest.CLDTTest and KernelTest.AssemblySupportTest subassemblies.

Advertisements