We're updating the issue view to help you get more done. 

NUnit3 [OneTimeTeardown] errors are not being reported as test failures

Description

Thrown exceptions inside a method marked with [OneTimeTeardown] are not being reported as failures, meaning the build server displays a failed build as 'succeeded'. This is because NUnit3 considers failed setups and teardowns as part of the TestFixture context (and not of the test context) and hence does not increment the failure counter of a test assembly inside the XML test report. Since the BuildScript's only check if a test run has failed is "$(_failures) > 0", the error condition never triggers and no error is raised.

The NUnit result XML does, however, provide a "result" attribute which is set to "Failed" even if the failure count is 0. Because of that, the result attribute should be used to determine whether the test run has succeeded or failed.

Assignee

Stefan Ilic

Reporter

Stefan Ilic

Labels

None

Components

Fix versions

Affects versions

Priority

Normal
Configure