Alistair Findlay

Software developer/manager and agile enthusiast

Quick tips: Unit testing async void methods in Visual Studio 2013

At the moment I am working on a side project to keep up to date on the various things going on in the world of REST APIs, Javascript frameworks, .NET and mobile apps.

One interesting thing I've come across is related to unit testing in Visual Studio 2013. When you have a unit test for an async void method, the Test Explorer panel does not seem to pick this up, as below:

Unit test not showing in Test Explorer

The solution is to modify the unit test to return a Task instead of a void. The Test Explorer should pick this up after re-build:

Unit test showing in Test Explorer

Essentially the difficulty of retrieving test results from a "fire and forget" method is the reason why the Visual Studio test framework chooses to ignore async void unit tests.

If you want to read more, there is an interesting article about this on MSDN magazine.

Overcoming resistance to Agile Part 4: Do it all over again

Blog title image

This post will describe the next steps to rolling out the use of agile to other projects, engaging the entire company in the process, and the important step of putting the customer at the heart of it all.

Continue reading ›

Overcoming resistance to Agile Part 3: Being visibly better

Blog title image

The previous post talked about using commonly agreed estimations to better plan the team’s work; this post will explain how you can start to engage the wider business by making progress through the work more visible.

Continue reading ›

Overcoming resistance to Agile Part 2: Making plans for Agile

Blog title image

Following on from the previous post about taking the first steps into using agile methods, this post will cover how you can progress to making better estimates for your project as a team.

Continue reading ›

Overcoming resistance to Agile Part 1: Just go for it!

Blog title image

In any business, changing deeply ingrained working practices can be a real challenge. As a developer you may want to employ agile working practices but meet resistance from other developers or managers in your company.

Continue reading ›