Wednesday, February 22, 2012

TFS 2010 - Microsoft.TeamTest.targets(14,5): Object reference not set to an instance of an object

While trying to build unit test projects, you might have seen this error intermittently
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamTest\Microsoft.TeamTest.targets(14,5): error : Object reference not set to an instance of an object.

To fix this issue, you should look at the warnings which you get while building this project. Even though they are not errors, these warnings could be the cause of intermittent failure. So try to fix the warnings and this should resolve the issue.

If this does not work, another fix is described at http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/bb0a1752-f6ce-4001-8b45-5aa72f1909e3

These steps need to followed:
  • Open the build definition
  • Go to Process tab
  • Select Logging Verbosity as Detailed

Tuesday, February 7, 2012

MSTEST - How to get the ID of a test

Sometimes you will come across situations where you need to find the ID of a testcase.
A common scenario is if you see an errors like:
Error adding test case xxx to test run: There is no test with specified Id {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.
The easiest way to find the ID of a testcase is to use either of these options:
Option 1
  • Run the desired test
  • Open the trx file in xml editor to view the ID of the test
 Option 2
  • Create a test list in the test list  editor
  • Add the desired test to the test list
  • Open the vsmdi file in xml editor to view the ID of the added test
 Option 3
  • Create an Ordered test
  • Add the desired test to the Ordered test
  • Open the Ordered test in xml editor to view the ID of the added test