In NUnit, è possibile ottenere il test corrente con NUnit.Framework.TestContext.CurrentContext
. Quando eseguo i test sul mio computer locale, questo è correttamente compilato durante i test. Tuttavia, quando viene inviato a un server di sviluppo che esegue TeamCity, questa struttura di dati presenta alcuni problemi che causano errori. Questi errori si verificano quando si accede a context.Test.FullName
, context.Test.Name
e context.Result
. Ad esempio, con il seguente codice:Come ottenere corrente TestContext in TeamCity NUnit runner
var name = NUnit.Framework.TestContext.CurrentContext.Test.Name;
si verifica questa eccezione, ma solo quando TeamCity è in esecuzione dei test:
TearDown method failed. TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
--TearDown
at NUnit.Framework.TestContext.TestAdapter.get_Name()
Is TeamCity non popolano il TestContext
o c'è un modo corretto per ottenere questo dati?