2

I'm currently writing an analysis system within which, in the solution, I have created multiple test projects.

I'm using Visual Studio 2008 Professional with Microsoft.VisualStudio.QualityTools.UnitTesting or the Microsoft Testing tools.

While creating a Test Project using the template, it uses some configuration to enable one to set the test project as the startup project so that when [F5] is pressed, the project test methods are run one after the other, or else, you can even click the Debug in Context button to debug one test at a time.

Having created my test projects normally just as I have done with the others, and referenced the Microsoft.VisualStudio.QualityTools.UnitTesting namespace in my project, plus having project-referenced my project that contains the classes to be tested, I can now not test or run any of the test method I have written.

  1. Is there a way for me to be able to run the tests just I as would have using a test project template?

  2. How to use Microsoft Testing like I would using NUnit, that is, only referencing it and importing its namespace and so forth?

  3. Are there any attributes I have to use somewhere at the assembly level or so to allow me to use my "normal" projects for testing?

Thanks in advance for the kind help! =)

Will Marcouiller
  • 23,773
  • 22
  • 96
  • 162

1 Answers1

3

You'll need to manually edit your project file to add a special ProjectTypeGuids element. There's no easier way around it, which is one of the many reasons that MSTest is not particularly well-suited for unit testing.

Mark Seemann
  • 225,310
  • 48
  • 427
  • 736
  • Thanks Mark for your answer! If I could, I'd upvote and upvote again as I hate MSTest for some small things and you listed them. I had never taken the time to think about all this before, but reading both articles provided, I admit that I never had problems making simple tests before I use MSTest. The sad sotry is that I'm stuck with it per customer request (government organization), and still, I don't get where the restrictions apply as they appear to me to be out of sense. The architects must have had good reason that I can't think of about the organization itself to take such decisions... – Will Marcouiller May 10 '11 at 11:23
  • By the way, I love SO for such reason to get answered by people who know what they're talking about, such as you! Thanks again sincerely! – Will Marcouiller May 10 '11 at 11:25