Answers:
请记住,您的Initialize / Cleanup方法必须使用正确的签名。
[AssemblyInitialize()]
public static void AssemblyInit(TestContext context) {}
[ClassInitialize()]
public static void ClassInit(TestContext context) {}
[TestInitialize()]
public void Initialize() {}
[TestCleanup()]
public void Cleanup() {}
[ClassCleanup()]
public static void ClassCleanup() {}
[AssemblyCleanup()]
public static void AssemblyCleanup() {}
您可以使用[TestInitialize]
的[SetUp]
和[TestCleanup]
为[TearDown]
。