pencilCake
pencilCake

Reputation: 53243

Can I run all the unit-tests defined in a TestClass from a TestMethod in another class?

I have a [TestClass] where I have bunch of unit-test methods to test "Process_00" related tasks.

And I have another [TestClass] where I have test methods to test various processes like:

[TestMethod]
public void TestProcess_00 {....}

[TestMethod]
public void TestProcess_01 {....}

[TestMethod]
public void TestProcess_02 {....}

Is it possible to run all the tests in a separete [TestClass] within a TestMethod like:

[TestMethod]
public void TestProcess_00() 
{ 
      Assert.IsTrue( //All the tests in a separete test class pass ); 

}

Upvotes: 1

Views: 288

Answers (1)

Strillo
Strillo

Reputation: 2972

I don't think you should do it. The purpose of a unit test is to verify a single piece of code, not to check that other unit tests are successful. You can achieve that by creating test lists in which you specify which TestMethods you want to run.

Upvotes: 3

Related Questions