Abhijeet
Abhijeet

Reputation: 13856

Should all TestMethods remain in same TestClass?

I have just begun to write Visual Studio unit tests for a MVC application.

I have created several TestClasses, and TestMethods inside them.

enter image description here

But when I use test explorer, I could see test methods from only one class.

enter image description here

And those come from this class, does that mean that I should have one and only one TestClass in one testproject?

[TestClass]
public class AndIHave_NoLakshyaDefined
{
    [TestMethod]
    public void IShouldBeAbleTo_SetLakshya()
    {

    }

    [TestMethod]
    public void AndIShouldBeAbleTo_DoThat()
    {

    }
}

Upvotes: 0

Views: 62

Answers (1)

Oleksandr Kobylianskyi
Oleksandr Kobylianskyi

Reputation: 3380

No, you can have as much test classes as you want inside your test project.

Check some things:

  • Your test classes and test methods are public.
  • You have built the entire solution without errros.

If both these statements are true and you still can't see all tests, please provide some examples of tests that you can't see.

Upvotes: 2

Related Questions