当我在teardown中使用Assert.Pass()时,它会将testcase标记为fail?我正在使用最新的NUnit版本

当我在teardown中使用Assert.Pass()时,它会将testcase标记为fail?我正在使用最新的NUnit版本,nunit,assertions,Nunit,Assertions,当我在teardown中使用Assert.Pass()时,它会将testcase标记为fail?我正在使用最新的NUnit版本 它在升级之前工作得很好 似乎在拆卸中明确不支持ResultStateException-请参阅源代码中的此注释 /// <summary> /// RecordTearDownException appends the message and stacktrace /// from an exception arising durin

当我在teardown中使用Assert.Pass()时,它会将testcase标记为fail?我正在使用最新的NUnit版本


它在升级之前工作得很好

似乎在
拆卸中明确不支持ResultStateException
-请参阅源代码中的此注释

    /// <summary>
    /// RecordTearDownException appends the message and stacktrace
    /// from an exception arising during teardown of the test
    /// to any previously recorded information, so that any
    /// earlier failure information is not lost. Note that
    /// calling Assert.Ignore, Assert.Inconclusive, etc. during
    /// teardown is treated as an error. If the current result
    /// represents a suite, it may show a teardown error even
    /// though all contained tests passed.
    /// </summary>
//
///RecordTearDownException追加消息和stacktrace
///测试拆卸过程中出现的异常
///任何以前记录的信息,以便
///早期故障信息不会丢失。注意
///在过程中调用Assert.Ignore、Assert.Inconclusive等
///拆卸被视为错误。如果当前结果
///表示套件,它甚至可能显示拆卸错误
///尽管所有包含的测试都通过了。
/// 


这似乎是合理的——我不确定你在什么情况下想要强迫你的失败测试显示为通过?如果您对此有一个真正的用例,我建议您发布一个Github问题,将其作为一个功能进行讨论,但这听起来不是理想的方法。

您的代码是什么样的?失败是什么样子的,是抛出错误,还是断言失败?只有teardown中的一个简单函数只包含assert.pass();失败是指testcase在测试资源管理器中被标记为失败,并显示以下消息:Teardown:Nunit.Framework.successException:据我所知,successException应该将testcase标记为通过