简体   繁体   中英

XUnit test is discovered but not run by 'run all tests'

My Visual Studio does discover my Xunit tests, but "run all" (ctrl+R, A) doesn't run them. I can however manually select these tests to run them.

Console output:

========== Discover test finished: 2 found (0:00:01,6982309) ========== ------ Run test started ------ ========== Run test finished: 0 run (0:00:01,8070484) ==========

In addition to XUnit I've installed xunit.runner.console and xunit.runner.visualstudio. I tested to confirm this on a fresh project. On my actual project the same occurs. Ctrl+R, A does run all MSTests, though.

Why doesn't "run all" work with XUnit?

I had the same issue. When picked one by one the tests ran fine, but when selecting several or all tests only some of them were executed, leaving other tests with exclamation mark (not run) without displaying any exception message.

I have finally found the problem: one of the NuGet packages (in my case V8.Net) was causing an exception when loading x64 version in Any CPU configuration, which caused the test runner silently drop execution of some (seemingly random) tests.

I have found this in the Event Viewer:

Faulting application name: dotnet.exe, version: 2.2.27818.2, time stamp: 0x5d09400d
Faulting module name: V8_Net_Proxy_x64.dll, version: 1.0.0.1, time stamp: 0x5cc8b077
Exception code: 0x80000003
Fault offset: 0x0000000000f810ee
Faulting process id: 0x36a8
Faulting application start time: 0x01d5487db05f8083
Faulting application path: C:\Program Files\dotnet\dotnet.exe
Faulting module path: C:\[my project path].BaseTests\bin\Debug\netcoreapp2.2\V8_Net_Proxy_x64.dll
Report Id: 4a76ea19-6dac-4c83-b589-252722073405
Faulting package full name: 
Faulting package-relative application ID:

Removing reference to the faulting dll solved the problem.

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