简体   繁体   中英

Running tests using Shims (Microsoft Fakes) in Nunit Console

I'm attempting to run my NUnit (2.6.4) tests via nunit-console.exe so that I can integrate them with Jenkins. I have some tests which use Microsoft Fakes in order to mock up DBFunctions. These tests run and pass in Visual Studio (2015 & 2017) with the NUnit 2 test adapter, but give the following error when run in the console:

1) Test Error : ProjectName.Tests.TestBusinessRules.TestName
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException : Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.ResolveProfilerPath()
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()
at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()
at ProjectName.Tests.TestBusinessRules.TestName() in E:\Work\SolutionName\ProjectName\Tests\TestBusinessRules.cs:line 642

Is there any way to get tests using Microsoft Fakes Shims running successfully using the NUnit console executable? Alternatively, is there a way to mock up DBFunctions which works well with NUnit?

Fakes and Shims requires tests are run through Test Explorer as the test runner. Sounds like this is what you're doing if you require NUnit Test Adapter because this extension allows Test Explorer to discover NUnit tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM