views:

141

answers:

2

Using VS2010, I can't seem to add additional test methods. If I set up my project like this

[TestMethod]
public void Test1()
{
   Assert.AreNotEqual(0,1);
}

[TestMethod]
public void Test2()
{
   Assert.AreNotEqual(0,1);
}

The only test that shows up in my Test View is Test1. How do I make sure Test2 gets in to that list?

EDIT: Additional tests that weren't initially created are not added to the list of tests. So if I was to add Test3 after running tests, then Test3 would not get added.

+1  A: 

Simplest way: Reopen the solution.

You can also open your test list file (the "vsmdi" file in your Solution Items folder) and hit the "refresh" button there.

A full rebuild of your solution works sometimes, too.

mafutrct
Where (what) is my test list file? Reopening the solution worked although a pain to do that each time a test is added.
Blake Blackwell
In your Solution Explorer, there is a folder called "Solution Items". In this folder, there should be at least 2 files. One ending in `.testrunconfig`, the other in `.vsmdi`. Vsmdi files contain test lists. Open the vsmdi file (just double click it). VS will display the Test List Editor. At the upper left, hit the refresh button.
mafutrct
Hmmm, refreshing the vsmdi file doesn't work. Any ideas why?
Blake Blackwell
I'm sorry, I don't know. I usually just full rebuild and/or reopen if a test fails to show up.
mafutrct
Ok - thanks for your help. At least the reopen refreshes the list. Perhaps a weird bug in RC1.
Blake Blackwell
A: 

I try to change the function name and the new test will added into the test list by refreshing the test view, but every time should do it, is there has any better way to avoid it?

Tbeck