What's the life cycle of Unit Tests in C#

↘锁芯ラ 提交于 2019-12-05 06:43:51

You are correct. This is indeed the order in which the code will be run. However, since tests should be completely independent, there are no guarantee that they will be run in order and that they will be run on a single thread. The framework could run multiple test at the same time.

You can force a specific test order through the use of test cases if you need too, but this is considered bad practice as test cases should be used to regroup tests together (tag them) instead.

To define a specific order for your tests, either create an ordered test (http://msdn.microsoft.com/en-us/library/ms182631.aspx) or create a match file and call mstest.exe for each test case in the specified order you desire (http://msdn.microsoft.com/en-us/library/ms182489(VS.80).aspx)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!