.NET Continuous unit testing : a dream comes true

Publié par Philippe Tremblay le vendredi 3 février 2012 à 18:00

Update: NCrunch was commercially released on mid-october 2012. The official pricing model does not affect my initial conclusion and I still think that NCrunch remains a very useful tool for any TDD developper.

For many years, I’ve been green with envy of those Java guys who could use tools like Infinitest and JUnitMax to continuously unit test their code. My wait is finally over. Similar tools have now become available for the .NET platform! Some of you may be wondering: “What’s the point of a continuous unit test tool?” In short, a continuous unit testing tool provides you, the developer, with constant feedback about the state of your unit tests without requiring any manual intervention on your part. It tells you immediately when you break something by running the tests automatically as soon as you change the code.

A few tools started to come out last year:

ContinuousTests

.NET Demon

NCrunch

I have not used ContinousTests or .NET Demon. Therefore, my intention in this article is not to compare these tools but to discuss my experience with NCrunch.

Running in the background

The first thing you notice when using NCrunch is that there is no need to save your file. A simple keystroke will launch the continuous test runner in the background. It does not interrupt your current work and you can always see the current status of your test in the Risk/Progress window.

NC_Progress Bar

Figure A – Progress Bar (1 failing test)

You can also see a more traditional detailed view of the tests in the Tests window.

NC_Tests Window

Figure B – NCrunch Tests Window

Code Editor Integration

NCrunch offers visual indicators of the state of your tests directly in the source code editor. All paths and lines of code covered by a working unit test (and the test themselves) have a green widget besides it. There is a red widget in front of all failing tests or code that isn’t covered.

NC_Code Integration

Figure C – Code Integration

Impact navigator

You can see which tests cover a specific line of code simply by clicking on the widget in front of the line.

NC_Impact Navigator

Figure D – Impact Navigator

Conclusion

I’ve been using NCrunch for a few months and have been extremely satisfied with it. It runs smoothly on almost every existing solution I have tried it on. The very few bugs I have had were all related to specific configuration errors within a solution.

NCrunch is free for the beta testing period but will be sold as a commercial product when it officially comes out. .NET Demon, from RedGate, has the same disclaimer. I guess (and hope) those products will be reasonably priced. Not all employers will invest on a tool that does not necessarily increase the developers’ productivity by much even though it provides them with a more enjoyable experience while doing TDD.

When I use this tool, it really makes me feel more nimble. I think price will be a key point given that many companies still think tools like Resharper are expensive toys instead of seeing them as really cheap investments to increase developer productivity.

At less than 50$, I would not even wait for my company to buy it. I’d buy it from my own pocket simply for my personal enjoyment and satisfaction. I’m eagerly awaiting the official launch of NCrunch. In the meantime, I’ll probably take a look at .Net Demon but I can tell you NCrunch has definitely become part of my TDD tool belt.

Mots-Clés :
blog comments powered by Disqus

0 Comments:

Post a comment

Comments have been closed for this post.