10 Sep 2005 robertc   » (Master)

Theres an interesting rant on why JUnit wasn't suitable for this guy 'Mike's tests, with the primary reason as I understand it that he creates X number of dynamically created tests and runs out of memory.

Whilst agreeing with him - if you aren't writing unit tests, xUnit may not be the right tool ... I think he would have been better served with something along the lines of (in python):

class DynamicTests(unittest.TestCase):
    expectedCount=1000
    def countTests(self):
        return self.expectedCount
    def runTest(self):
        for int in range(self.expectedCount):
            do_whatever_to_test_this_case

The point being that the xUnit framework imposes No Requirement that a test case _be_ an instance - it uses a composite pattern, and any element can be a test case, a container for tests, or both. If you need to write many related tests that (for example) need to store no local state, require the same temporary resources, then leverage the nature of the composite.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!