How to get current TestContext in TeamCity NUnit runner

In NUnit, you can get the current test with NUnit.Framework.TestContext.CurrentContext. When I run tests on my local machine, it populates correctly during testing. However, when clicking on the Dev server running TeamCity, this data structure has some problems that cause errors. These errors occur when accessing context.Test.FullName, context.Test.Nameand context.Result. For example, with the following code:

var name = NUnit.Framework.TestContext.CurrentContext.Test.Name;

this exception occurs, but only when TeamCity runs the tests:

TearDown method failed. TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
--TearDown
   at NUnit.Framework.TestContext.TestAdapter.get_Name()

Doesn't TeamCity populate TestContextor is there a proper way to get this data?

+5
source share
1 answer

: , TeamCity TestContext. , NUnit . , NUnit, , .

, , ( ).

+1

All Articles