views:

282

answers:

3

I'm developing in C# on the Castle stack. I'm new to unit testing, and I've heard that a more flexible language (than C#) might make writing tests easier.

Do you think it is worth the time to learn Boo just for writing unit tests?

We use the SharpDevelop IDE, so have Boo support available, and I've kind of been looking for an excuse to learn a new CLR language, but I just don't want it to get in the way of learning unit testing.

A: 

If it's politically viable at your company, probably. Testing code usually has much less coupling than production code, letting you get away with playing with and exploring the language used. This would make it a good environment to get your hands on a new language.

Sii
+1  A: 

If you're new to unit testing, it might be best to use a familiar language at least until you have the basics under control (maybe a couple of weeks). When you feel that the language/framework that you use is too verbose or restrictive, try something else.

I'm developing mostly in Java, but I'm planning on moving to Scala. In the future I might still write some parts of the application code in Java, but for the tests I would prefer using Scala, Ruby, Groovy or similar language with a more flexible syntax. For example, with Java/C# you need to use long descriptive method names for the tests, but with a more flexible language you can use just plain strings, which makes the test names much more readable: http://www.codecommit.com/blog/java/the-brilliance-of-bdd

Esko Luontola
+4  A: 

In order to really take advantage of Boo as a testing language, take a look at Specter (a BDD framework implemented as a Boo DSL). Otherwise it's just another CLR language using xUnit.

If you're just starting out with unit testing, I agree with Esko, just go with C# + NUnit, you'll find much more information and sample code.

Is this a web project? Another good excuse for learning Boo is using the Brail view engine (originally from Monorail but now also available for ASP.NET MVC)

Mauricio Scheffer
Thanks, great advice.In fact it is for a Monorail project. Currently I'm using NVelocity for the views (which I chose for similar reasons that you put so eloquently above). SO yeah I have in the back of my mind that Brail might be handy sometime.
nocache