Sunday, May 15, 2011

(Win)Unit Test Native Code

Came across a tool called WinUnit, from Microsoft, for unit testing native (unmanaged) C/C++ code on windows through an article "Simplified Unit Testing for Native C++ Applications" by Maria Blees.

Introduction
As per CodePlex, WinUnit is:
.NET languages have great unit testing tools such as NUnit or MSTest, but native C/C++ developers have fewer and less convenient options. WinUnit is a project that brings NUnit-like testability directly to native code. With WinUnit, you focus on just your test code and WinUnit takes care of the rest. It comes with a complete library that makes creating tests simple, and a runner program to run them.
WinUnit Vs BOOST Vs CPPUnit
BOOST.Test and CPPUnit were couple of other widely known/used tools. There are lot other existed but WinUnit was picked among all, with one main reason - No test runner to be implemented. One can focus only on writing tests without bothering about the test runner and that reduces (considerable) coding effort too.

Some of the advantages in using WinUnit are:
  • Writing Tests and running them are made easy.
  • Integration with Visual Studio is easy and includes macros to setup your projects to use WinUnit. Also, to run tests.
  • No separate test runner is required comparing with other BOOST.Test/CPPUnit tools.
  • Also, code coverage statistics (% or Count of lines covered or not covered) can be generated easily as if NUnit/MSTest does in .Net Applications.
Downloads
Binaries and Samples are @ http://winunit.codeplex.com/
Source is @ http://msdn.microsoft.com/en-us/magazine/cc164218.aspx

Friday, May 6, 2011

Order of Installation

On my machine, While TFS (Team Foundation Server) items are being accessed (in the sense, clicking on any work item to view it's details), The VS 2008 Team Explorer is showing the below error:  
Could not load type 'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemTypeDeniedOrNotExistException' from assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client, Version =9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Seems that the order of the installation that I did was wrong - Installed VS 2008 SP1 before Team Explorer and should actually be other way round. Re-installing the VS 2008 SP1 in such cases, shall resolve the issue.

Order of installation must always be - Visual Studio 2008 > Team Explorer > Visual Studio 2008 SP1.