How to create Startup and Cleanup script for Visual Studio Test Project?

后端 未结 1 1588
遇见更好的自我
遇见更好的自我 2020-12-15 18:23

I\'m using a Visual Studio Test project, am modifying the test config with deployment files, etc. (through the VS GUI) and now I need to write a Startup script for the test

相关标签:
1条回答
  • 2020-12-15 18:59

    Create a unit test in your test project. In the unit test class, create methods with the [TestInitialize] and [TestCleanup] attributes. They will be run before/after each test method.

    Or, if you want to run before/after all test in that class, create static methods with [ClassInitialize] and [ClassCleanup] attributes.

    Lastly, to run before/after all tests in the assembly, create static methods with [AssemblyInitialize] and [AssemblyCleanup] attributes.

    0 讨论(0)
提交回复
热议问题