MicroTest 1.3 / MicroStub 1.1: still under 4KB

Posted by Mathew Abonyi Wed, 24 Jan 2007 06:33:07 GMT

MicroTest has had a few tweaks, making it more brief and efficient at what it does. Also, I added a setup and teardown interface which can be used. For example, I removed the use of ObjectSpace and squeezed a few percent of performance just from that. On my 1.83GHz, the 6 tests of the self test now consistently take around 500 microseconds (or 0.0005 seconds). Pretty nippy.

MicroStub had a little problem with it—it stubbed instance methods and didn’t return the class back to normal. So, it violated one of the most basic principles of testing: isolated tests. That’s all fixed now, using some Spartan back-and-forth aliasing. Obviously a double stub will fail. Maybe I’ll fix that later.

Lastly, I added a benchmarking test case, really just useful for profiling.

Of course, the library is still under 4KB—in fact, it’s 3940 bytes.

Have a look at the repository (revision 25) for the latest version.

Posted in  | no comments | 4 trackbacks

MicroTest 1.2 & MicroStub 1.0: Your microscopic testing pals

Posted by Mathew Abonyi Sun, 21 Jan 2007 17:49:43 GMT

Just after writing the previous post, I discovered the need for a little bit of method stubbing and promptly fell upon the task with MicroStyle1. Also, I will officially keep MicroTest under 4 kilobytes2.

So, without further ado, here are the latest new features of MicroTest:
  • colour output
  • execution time in microseconds
  • MicroStub: overwrite a method with stub()
  • twice as fast (no sweat)
  • a self-test! (SELFTEST=true ruby microtest.rb)
  • and its own home. Awwww.

MicroTest now lives in my Google Code SVN repository.

  svn co http://mabs29.googlecode.com/svn/trunk/other/microtest/

1 By the way, if you haven’t noticed yet, I’ve been a little inspired by Camping.

2 Unlike Camping (because MicroTest is less complicated), I think it only fair that the 4 kilobytes include comments and the self-test.

Posted in  | no comments | 4 trackbacks

Older posts: 1 2 3 ... 5