10 Sep 2005

10Sep05

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=1000def countTests(self):return self.expectedCountdef 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.

About these ads


No Responses Yet to “10 Sep 2005”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 1,056 other followers

%d bloggers like this: