xUnit 1.6 support

Topics: ReSharper test runner
Jun 20, 2010 at 11:41 PM

Would be nice.

Jun 20, 2010 at 11:42 PM
Edited Jun 20, 2010 at 11:43 PM

Especially for R#5.1 EAP build :)

Jun 21, 2010 at 11:58 AM

Hehehe. Already opened an issue

Jun 21, 2010 at 4:59 PM
It should just work. That's the beauty of the version independent runner system.
Jun 21, 2010 at 7:01 PM

Well, unfortunately, it looks like this runner is not so "version independent" yet :(

Of cause, may be I'm doing something wrong, but I've got multiple run-time exceptions when open class with xUnit tests on VS2010 project that reference xUnit.dll v1.6.0.1516:

Could not load file or assembly 'xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The system cannot find the file specified.

--- EXCEPTION #1/2 [FileNotFoundException]
Message = “Could not load file or assembly 'xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The system cannot find the file specified.”
ExceptionPath = Root.InnerException
ClassName = System.IO.FileNotFoundException
HResult = COR_E_FILENOTFOUND=E_FILENOTFOUND=80070002
Source = xunitcontrib.runner.resharper.provider.5.1
FileNotFound_FileName = “xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c”
FileNotFound_FusionLog = “
  WRN: Assembly binding logging is turned OFF.
  To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
  Note: There is some performance penalty associated with assembly bind failure logging.
  To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

StackTraceString = “
  at XunitContrib.Runner.ReSharper.UnitTestProvider.UnitTestElementIdentifier.IsDirectUnitTestClass(IClass class)
     at XunitContrib.Runner.ReSharper.UnitTestProvider.UnitTestElementIdentifier.IsAnyUnitTestElement(IDeclaredElement element) in C:\Users\matt\Projects\xunitcontrib\xunitcontrib\resharper\xunitcontrib.runner.resharper.provider.5.1\UnitTestElementIdentifier.cs:line 15
     at XunitContrib.Runner.ReSharper.UnitTestProvider.SuppressUnusedXunitTestElements.SupressUsageInspectionsOnElement(IDeclaredElement element) in C:\Users\matt\Projects\xunitcontrib\xunitcontrib\resharper\xunitcontrib.runner.resharper.provider.5.1\SuppressUnusedXunitTestElements.cs:line 31
     at JetBrains.ReSharper.Daemon.UsageChecking.SupressUsageInspectionsUtil.<>c__DisplayClass1.<ShouldSupressUsageInspections>b__0(IUsageInspectionsSupressor supressor) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\UsageChecking\SupressUsageInspectionsUtil.cs:line 17
     at System.Linq.Enumerable.AnyImpl[TSource](IEnumerable`1 source, Func`2 predicate) in c:\Agent\work\921e1f35028b1c7e\Platform\src\Util\src\System.Core\Enumerable.Quantifiers.cs:line 83
     at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate) in c:\Agent\work\921e1f35028b1c7e\Platform\src\Util\src\System.Core\Enumerable.Quantifiers.cs:line 49
     at JetBrains.ReSharper.Daemon.UsageChecking.SupressUsageInspectionsUtil.ShouldSupressUsageInspections(IDeclaredElement element, ImplicitUseKindFlags& flags) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\UsageChecking\SupressUsageInspectionsUtil.cs:line 23
     at JetBrains.ReSharper.Daemon.UsageChecking.UsageAnalyzer.ProcessDeclaration(IDeclaration declaration, IDeclaredElement element, IParameters parameters) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\UsageChecking\UsageAnalyzer.cs:line 474
     at JetBrains.ReSharper.Daemon.CSharp.Stages.CSharpUsageAnalyzer.ProcessDeclaration(IDeclaration declaration, IDeclaredElement element, IParameters parameters) in c:\Agent\work\921e1f35028b1c7e\src\Daemon.CSharp\src\Stages\CSharpUsageAnalyzer.cs:line 26
     at JetBrains.ReSharper.Daemon.UsageChecking.UsageAnalyzer.ProcessElement(IElement element, IParameters parameters) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\UsageChecking\UsageAnalyzer.cs:line 85
     at JetBrains.ReSharper.Daemon.CSharp.Stages.CSharpUsageAnalyzer.ProcessElement(IElement element, IParameters parameters) in c:\Agent\work\921e1f35028b1c7e\src\Daemon.CSharp\src\Stages\CSharpUsageAnalyzer.cs:line 60
     at JetBrains.ReSharper.Daemon.UsageChecking.CollectUsagesStageProcess.ProcessAfterInterior(IElement element) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\UsageChecking\CollectUsagesStageProcess.cs:line 405
     at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.RecursiveElementProcessorProxy.ProcessAfterInterior(IElement element, Object context) in c:\Agent\work\921e1f35028b1c7e\src\Psi\src\IRecursiveElementProcessor.cs:line 55
     at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendants[TContext](IElement root, IRecursiveElementProcessor`1 processor, TContext context) in c:\Agent\work\921e1f35028b1c7e\src\Psi\src\IRecursiveElementProcessor.cs:line 101
     at JetBrains.ReSharper.Psi.RecursiveElementProcessorExtensions.ProcessDescendants(IElement root, IRecursiveElementProcessor processor) in c:\Agent\work\921e1f35028b1c7e\src\Psi\src\IRecursiveElementProcessor.cs:line 75
     at JetBrains.ReSharper.Daemon.UsageChecking.CollectUsagesStageProcess.Execute(Action`1 commiter) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\UsageChecking\CollectUsagesStageProcess.cs:line 347
     at JetBrains.ReSharper.Daemon.Impl.DaemonProcessBase.DoHighlighting(DaemonProcessKind processKind, Action`1 commiter) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\Impl\DaemonProcessBase.cs:line 171


--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “Could not load file or assembly 'xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The system cannot find the file specified.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
Data.LastExtension = cs
Data.VsVersion = 10.0.30319.1
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.ReSharper.Daemon.Impl.DaemonProcessBase.DoHighlighting(DaemonProcessKind processKind, Action`1 commiter) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\Impl\DaemonProcessBase.cs:line 191
     at JetBrains.ReSharper.Daemon.Impl.VisibleDocumentDaemonProcess.DoHighlighting(Boolean globalAnalysisStages) in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\Impl\VisibleDocumentDaemonProcess.cs:line 238
     at JetBrains.ReSharper.Daemon.Impl.VisibleDocumentDaemonProcess.<>c__DisplayClass6.<EnqueueHighlightingJob>b__4() in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\Impl\VisibleDocumentDaemonProcess.cs:line 209
     at JetBrains.ReSharper.Daemon.Impl.DaemonThreadImpl.DaemonThreadProc() in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\Impl\DaemonThreadImpl.cs:line 126
     at JetBrains.Util.Logger.Catch(Action action) in c:\Agent\work\921e1f35028b1c7e\Platform\src\Util\src\Logger\Logger.cs:line 245
     at JetBrains.ReSharper.Daemon.Impl.DaemonThreadImpl.<.ctor>b__1() in c:\Agent\work\921e1f35028b1c7e\src\Daemon\src\Impl\DaemonThreadImpl.cs:line 33
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.ThreadHelper.ThreadStart()

Jun 21, 2010 at 7:53 PM
Don't touch any DLL that's used by the Resharper runner, only the one that you link against for your tests.
Coordinator
Jun 21, 2010 at 8:19 PM

I'm surprised this has failed. As Brad says - the test runner uses the version independent runner system. The test provider (the part of the plugin that appears to be failing in this instance) is compiled against version 1.5 of xunit.dll, and requires that version - changing that dll can cause the plugin to fail in the way you describe. But it's only using that dll for recognising tests. Running tests is delegated to the version of xunit.dll that you have referenced in your project.

Which means, leave xunit.dll 1.5 in the plugin directory and just reference the version you need in your project. I've got tests that work just fine with 1.5 and 1.1 - now that 1.6 is out I'll update these to make sure everything still works.

Let me know if everything works using just the dlls in the plugin download.

Matt

Jun 21, 2010 at 9:47 PM

Ok, my bad - everything is working fine now :)

Thanks, guys and sorry for false alarm.

Coordinator
Jun 22, 2010 at 2:00 PM

No problem. I've tested version 1.6 locally, and all is good - the existing runners support 1.6 without any changes. Tested on .net 3.5 (vs2008) and .net 4 (vs2010) in AnyCpu, x86 and x64.

I'll be checking in the tests this evening.

Thanks
Matt 

Apr 5, 2013 at 7:20 AM
Hi ,

I am using visual studio 2012 and added XUnit 1.9 and SubSpec.dll in Add reference and tried to run the test.

I got the below error. :( Can any one of you help me to resolve on this issue?

Error: System.IO.FileLoadException: Could not load file or assembly 'xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c'
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable)
at System.Reflection.CustomAttribute.IsDefined(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.Reflection.RuntimeMethodInfo.IsDefined(Type attributeType, Boolean inherit)
at Xunit.Sdk.Reflector.ReflectionMethodInfo.HasAttribute(Type attributeType)
at Xunit.Sdk.MethodUtility.IsTest(IMethodInfo method)
at Xunit.Sdk.TypeUtility.<GetTestMethods>d__0.MoveNext()
at Xunit.Sdk.TypeUtility.ContainsTestMethods(ITypeInfo type)
at Xunit.Sdk.TypeUtility.IsTestClass(ITypeInfo type)
at Xunit.Sdk.TestClassCommandFactory.Make(ITypeInfo typeInfo)
at Xunit.Sdk.Executor.RunTests..ctor(Executor executor, String type, List1 methods, Object handler)
at Xunit.Sdk.Executor.RunClass..ctor(Executor executor, String type, Object handler)
at Xunit.ExecutorWrapper.RethrowWithNoStackTraceLoss(Exception ex)
at Xunit.ExecutorWrapper.CreateObject(String typeName, Object[] args)
at Xunit.ExecutorWrapper.RunClass(String type, Predicate
1 callback)
at Xunit.TestRunner.<>c__DisplayClass6.<RunClass>b__4()
at Xunit.TestRunner.CatchExceptions(TestRunnerDelegate func)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Thanks,
Nithya
Coordinator
Apr 5, 2013 at 7:38 AM
Something's trying to load xunit 1.5, although you said you added 1.9.

Where did you get subspec from? What version of xunit does it require?
Apr 5, 2013 at 7:58 AM
Edited Apr 5, 2013 at 8:05 AM
Thanks for the response.

I have got the supspec very long back(2 years ago)..

Can you pls help me to get the latest version of subspec(to support in visual studio 2012)?
Coordinator
Apr 5, 2013 at 9:15 AM
Er, I don't know where subspec comes from - I can't provide technical support for it. If you can find the download, perhaps there's a newer version that supports xunit 1.9.1, or perhaps the download includes the required xunit 1.5.
Sep 24, 2013 at 10:47 AM
Sorry, a touch late... Chances are its subspec.codeplex.com - its CI builds are against 1.8 IIRC (SubSpec's SpecificationAttribute is derived from FactAttribute).

Adding a binding redirect for xunit.extensions and xunit will do the trick (and this can be done via Add-BindingRedirect in the Package Manager Console)