Controlling execution order of unit tests in Visual Studio

前端 未结 9 1826
情歌与酒
情歌与酒 2020-11-27 15:44

Okay, I\'m done searching for good information on this. I have a series of Unit Tests that call a static class which, once initialized, sets properties that cannot (or I don

9条回答
  •  我在风中等你
    2020-11-27 16:12

    they just can't be run together in a random order as there is no way to tear down the static class

    You can name namespaces and classes in alphabetical order. eg.:

    • MyApp.Test.Stage01_Setup.Step01_BuildDB
    • MyApp.Test.Stage01_Setup.Step02_UpgradeDB
    • MyApp.Test.Stage02_Domain.Step01_TestMyStaff
    • MyApp.Test.Stage03_Integration.Step01_TestMyStaff

    where MyApp.Test.Stage01_Setup is a namespace and Step01_BuildDB is a class name.

提交回复
热议问题