升级到 v2 后 xunit 无法发现测试
xunit cannot discover tests after upgrading to v2
升级到 xunit2 并遵循迁移指南 (http://xunit.github.io/docs/test-migration.html) 后,在我的项目中发现测试时出现以下错误:
------ Discover test started ------
[xUnit.net 00:00:00.0701819] Exception discovering tests from MyLibrary.Tests.dll: System.MissingMethodException: Constructor on type 'Xunit.Sdk.TestFrameworkProxy' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at Xunit.RemoteAppDomainManager.CreateObject[TObject](String assemblyName, String typeName, Object[] args)
at Xunit.Xunit2Discoverer..ctor(ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder)
at Xunit.XunitFrontController.CreateInnerController()
at Xunit.XunitFrontController.get_InnerController()
at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.DiscoverTests[TVisitor](IEnumerable`1 sources, IMessageLogger logger, Func`3 visitorFactory, Action`3 visitComplete, Stopwatch stopwatch)
========== Discover test finished: 0 found (0:00:00.2454142) ==========
我没有调试 testrunners 或 xunit 的经验,所以我不知道去哪里找。我希望有人以前遇到过这个问题并且可以快速回答,但是我的 google-fu 什么也没显示。
我不知道什么信息对跟踪这个问题有用,所以我会根据人们的要求添加内容。
来自测试运行器文档:If you're having problems discovering or running tests, you may be a victim of a corrupted runner cache inside Visual Studio
。
删除 %TEMP%\VisualStudioTestExplorerExtensions
似乎可以解决问题。
确保您已经安装了 Xunit 和 Xunit.Runner.VisualStudio nuget 包
升级到 xunit2 并遵循迁移指南 (http://xunit.github.io/docs/test-migration.html) 后,在我的项目中发现测试时出现以下错误:
------ Discover test started ------
[xUnit.net 00:00:00.0701819] Exception discovering tests from MyLibrary.Tests.dll: System.MissingMethodException: Constructor on type 'Xunit.Sdk.TestFrameworkProxy' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at Xunit.RemoteAppDomainManager.CreateObject[TObject](String assemblyName, String typeName, Object[] args)
at Xunit.Xunit2Discoverer..ctor(ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder)
at Xunit.XunitFrontController.CreateInnerController()
at Xunit.XunitFrontController.get_InnerController()
at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.DiscoverTests[TVisitor](IEnumerable`1 sources, IMessageLogger logger, Func`3 visitorFactory, Action`3 visitComplete, Stopwatch stopwatch)
========== Discover test finished: 0 found (0:00:00.2454142) ==========
我没有调试 testrunners 或 xunit 的经验,所以我不知道去哪里找。我希望有人以前遇到过这个问题并且可以快速回答,但是我的 google-fu 什么也没显示。
我不知道什么信息对跟踪这个问题有用,所以我会根据人们的要求添加内容。
来自测试运行器文档:If you're having problems discovering or running tests, you may be a victim of a corrupted runner cache inside Visual Studio
。
删除 %TEMP%\VisualStudioTestExplorerExtensions
似乎可以解决问题。
确保您已经安装了 Xunit 和 Xunit.Runner.VisualStudio nuget 包