Showing posts with label mstest. Show all posts
Showing posts with label mstest. Show all posts

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

 

Monday, December 5, 2011

MSTEST - UTA004: Illegal use of attribute on testmethod

Have you seem this error UTA004: Illegal use of attribute on testmethod. The TestMethodAttribute can be defined only inside a class marked with the TestClass attribute. while trying to run a mstest unit test.
The common scenario when this occurs is if there is a method with [TestMethod] attribute but the class in which it is defined does not have [TestClass] attribute.
However, even if you add the [TestClass] attribute and the error does not go away, the reason is that the class is not public.

Hence, make sure that the class is public and it has [TestClass] attribute.