gpt4 book ai didi

c# - 当 MSTest 在 TestInitialize 中失败时,为什么不执行 TestCleanup?

转载 作者:行者123 更新时间:2023-11-30 13:58:16 24 4
gpt4 key购买 nike

我有一个基类,其中有一个 TestInitialize 和一个 TestCleanup。然后我有其他继承自此类的测试类。 TestCleanup 应该在派生类的测试失败时执行某些操作。

TestCleanup 会在实际测试失败时执行。但是,当 TestInitialize 中的测试失败时,甚至不会执行 TestCleanup。为什么会发生这种情况,有没有办法让 TestCleanup 无论如何都被调用?

我认为 TestInitializeTestCleanup 在基类中根本不会导致这个问题,我只是想提供更多信息以防万一。

最佳答案

这是一个已知问题。看起来它已报告给 Microsoft connect。

http://connect.microsoft.com/VisualStudio/feedback/details/694337/testcleanup-method-does-not-run-when-it-should

关于c# - 当 MSTest 在 TestInitialize 中失败时,为什么不执行 TestCleanup?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17788466/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com