So, you decided to implement your own testing tool. You have also tried to run your tool using the Generic Test option on Visual Studio and even implemented the results file as explained on this msdn article. Nevertheless, you are not satisfied with the result and you consider writing a Custom Test Type for VS 2010. Welcome to the club!
Writing a custom test type is not an easy task and collecting the required information is not that obvious. I didn't see a lot of blog posts on this subject. So my aim here is to provide some information on the subject to improve the situation.
The first thing I was looking for was an example. After asking questions on stackoverflow and msdn forums and after doing my on research I stumbled upon a sample called myTest that is stored here. To be able to use this sample you should have the Visual Studio 2010 SDK installed. You can find the last version of the SDK on this location.
So I downloaded the sample loaded it to visual studio and compiled it. I was surprised to see a lot of compilation errors. Here is an example of such error:
The primary reference "Microsoft.VisualStudio.QualityTools.Tips.TuipPackage" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".
This error told me that I am referencing a version of TuipPackage that was compiled against the .NET Framework 4.5 while the project is targeted to the .NET Framework 4.0. It's strange since I didn't change anything on the sample. I just loaded it to Visual Studio.
After some thinking I found the solution. I had installed Visual Studio 2012 beta and its SDK on my machine before. After I uninstalled the beta there were still leftovers of the 2012 SDK on my GAC. When I loaded the sample the project referred to the most up to date version of the TuipPackage on my GAC and hence the errors.
Now the fix is easy – change the project to refer to the correct version of the following assemblies:
After fixing these issues the solution compiled, but with one warning:
"Found conflicts between different versions of the same dependent assembly."
The reason for this error turned out to be yet another dll that had the version 22.214.171.124. The dll name is "Microsoft.VisualStudio.QualityTools.TMI". Removing the reference and removing some using statements that referred to this dll will make the solution compile without a problem.
Phew, that is a lot of work to make a sample compile, but it will be help me advance in my quest for a custom test type.
That is it for this time. On the next part we will talk about reasons for writing a custom test type and we will take a closer look on the example test type.