State of rs tests

Posted by rue, Mon Oct 02 04:36:00 UTC 2006

As mentioned earlier, I was working on converting the rs tests from RSpec to chris2’s Test::Spec based on Test::Unit. The conversion went smoothly apart from some minor extra work in mocking (these should be resolved in the next release). I was able to clean up some things and actually fixed a minor bug—and more than one not-quite-perfect test where the original version could not confidently be said to be correct.

It also put the tests so far in perspective—with BDD, I seem to be more focused on the process of writing code via specifications—which I think I am still using nowhere near to their potential—which is rewarding; but it comes with the price of not testing for failure except for egregious cases. Generally, I am ensuring that the code works with expected input and the corner cases I have thought of but I am not going out of my way to hammer it with random data or known Bad Stuff™. This is definitely something that needs to be improved on in the future.

Some stats on the tests: the working directory I was using is missing some of the newest changes but it clocks in at around 330 lines of Ruby code for the rs libraries with slightly over 1500 lines of tests— an almost 5:1 ratio. There are 76 specifications and a total of 131 requirements (assertions, if you wish)—essentially one assertion for three lines of Ruby code. For your amusement, here is a logfile of a test run with the SpecDox runner.

Filed Under: rs | Tags:

Comments

Have your say

A name is required. You may use HTML in your comments.