Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xunit cannot discover tests after upgrading to v2

Tags:

xunit

After upgrading to xunit2 and following the migration guide (http://xunit.github.io/docs/test-migration.html), I get the following error when discovering tests in my projects:

------ 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) ==========

I have no experience debugging testrunners or xunit, so I don't know where to look. I hope someone has encountered the problem before and can give a quick answer, but my google-fu shows nothing.

I don't know what information would be useful for tracking down this problem, so I'll add things as people ask for them.

like image 379
simendsjo Avatar asked Dec 24 '22 20:12

simendsjo


1 Answers

From the test runner documentation: If you're having problems discovering or running tests, you may be a victim of a corrupted runner cache inside Visual Studio.

Deleting %TEMP%\VisualStudioTestExplorerExtensions seems to fix the issue.

Ref.: http://xunit.github.io/docs/running-tests-in-vs.html

like image 120
simendsjo Avatar answered Dec 28 '22 10:12

simendsjo