In a previous article I said I’d like to test my .Net code using RSpec so I’ve spent some time this weekend having a go at just that. IronRuby is still at alpha so was pretty flaky and I spent a lot of time hacking IronRuby and RSpec, but satisfyingly I eventually got it all working and did a few proof of concept examples. Surprisingly or not, there’s quite a few people out there with the same idea so if you want to have a go you wouldn’t go too far wrong to look at some of the examples I found (although none of them worked for me straight out of the box):
Getting Started With IronRuby And RSpec
BDD-style feature tests using IronRuby and RSpec/Cucumber
Example of using ironRubys mini_rspec library
Yeah, so game on I think. If you’re not sure why I’m so excited by the prospect of doing this I suggest you have a look at some BDD examples using RSpec and Cucumber. In my mind it’s light years ahead of what we can currently do with the .Net framework.
Whilst I really like the idea of actually doing this I do have some reservations:
- You still have to compile your .Net code so no enormous time savings.
- RSpec takes some time to get going as well, which is not a problem if you’re doing a large run but might be quite annoying otherwise.
- Have no idea how you’d be able to get test coverage reports (I’m sure some bright spark will get this working soon enough).
- Not exactly sure how debugging would work (stepping into your .Net code from an RSpec test).
On a side note and forgetting about the instability of it for a second I was really impressed with IronRuby and the CLR interop so, er.. *gulp* well done Microsoft!

Leave a Reply