0

it is me again...too much question, I know, but in this I'm kind of a newbie...

Well, I have a problem creating test for a project that is built using Microsoft's Web Client Software Factory: I get a error that says:

Unable to set TestContext property for the class MyClassName. Error: System.ArgumentException: Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'..

and the test never runs, any ideas?

Again, thanks in advance =)

Hugo
  • 6,244
  • 8
  • 37
  • 43

3 Answers3

0

What is the type of the TestContext property of your MyClassName class? According to the error message, it's the wrong type. Compare it with the tests that work.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • The thing is, I don't a test that works... :/ and, in MyClassName I don't have a TestContext property. Thanks, I think this is a first good tip to continue the search =) – Hugo Mar 30 '09 at 19:07
  • Doesn't the factory come with unit tests already? Look at one of those. Also, does your class have a base class? Maybe the property is in the base class. – John Saunders Mar 30 '09 at 19:09
  • 1
    Well, it turns out I do not need that "TestContext" (or at least), it seems that: I just deleted that property and I was able to run the tests...well, I will follow that path and hope not to find more troubles...thanks John =) – Hugo Mar 30 '09 at 22:42
  • Thanks Hugo, deleting the "TestContext" property worked for me too :-) – Doctor Jones Mar 01 '10 at 13:49
0

Again, one of those seely details: I just had to update the reference of these libraries:

  • Microsoft.VisalStudio.QualityTools.UnitTestFramework
  • Microsoft.VisalStudio.QualityTools.WebTestFramework

from version 8.0 to 9.0. Really seely, but that worked.

Thanks for everything.

Hugo
  • 6,244
  • 8
  • 37
  • 43
0

This is the kind of non-specific answer I hate, but here goes anyway:

Use a different unit test framework!

I've spent at least 3 times more time fixing tests that fail because of MSTest's "features" than fixing code that has bugs.

Feel free to downvote this because it doesn't help Hugo. My true aim is to help warn others away from the MSTest beast.

James McLachlan
  • 1,368
  • 13
  • 27