In MSTest how to find the total number of tests to run in ClassInitialize or AssemblyInitialize?
问题 Using MStest - I want to find the total number of test methods which are queued for run. How should I capture this value in ClassInitialize() or AssemblyInitialize() method. Only thing I get is TestContext which has no details of total number of tests. 回答1: I actually have an answer to this one, but you have to use Reflection to do it. This method gets all of the tests in the class and runs them. Each test starts with the string "TC" for test case. -sulu public async Task RunServiceTests() {