nunit3-netcore-console.dll无法识别部分测试程序集的测试用例
NUnit3控制台工具--explore参数无法识别部分测试程序集的问题
- 使用
nunit3-netcore-console 3.16.3配合--explore参数枚举96个C#测试程序集的测试用例,其中7个程序集无法被识别出测试用例 - 执行命令:
dotnet nunit3-netcore-console.dll --noheader --explore Tests.dll - 该问题在Windows和Linux环境下均存在
已排查内容
- 对比可用与不可用程序集的csproj文件,未发现明显差异:
- 均以.NET 6为目标框架
- 依赖版本完全一致:Microsoft.NET.Test.Sdk(17.7.0)、NUnit(3.13.3)、NUnit3TestAdapter(4.5.0)
- App.config中无程序集重定向配置
- 换用
nunit3-console.exe 3.10.0测试,存在相同问题 dotnet test可正常运行所有测试,但因需要使用过滤功能,无法替换为dotnet test --list-tests
相关错误信息
执行命令时会出现如下加载错误,但部分能正常识别测试的程序集也会报此错误,当前仅关注--explore功能是否可用:
Unable to load one or more of the requested types. Could not load file or assembly 'System.Data.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
内容的提问来源于stack exchange,提问作者Kurt
相关产品推荐
相关产品推荐

