mercredi 22 avril 2015

How does visual studio unit test run?

how does visual studio 2012 run unit tests?

My assumption is that, for every TestMethod, VS will create an independent object of the test class, go through the TestInitialize method, and run the TestMethod.

For example, I got TestMethod A(),B(),C() and a TestInitialize method Init() in a Test class called FunTest. So if I run all unit tests in this class, I'll got three instance of FunTest, say FunA, FunB and FunC. And these 3 object will have method call stack Init()->A(), Init()->B(), Init()->C() independently. The Init() method will be called 3 times by 3 different instances.

I tried my assumption in VS and it works as I expected. But I cannot confirm it in case I missed anything during execution.

So is it right?

Aucun commentaire:

Enregistrer un commentaire