expecto-adapter icon indicating copy to clipboard operation
expecto-adapter copied to clipboard

Parameter count mismatch in Discovery

Open jackfoxy opened this issue 8 years ago • 3 comments

To reproduce, use my project https://github.com/jackfoxy/PSlogger

Checkout initial commit in master branch. (I will be making more commits, and the initial commit is quite simple, with only one test in one test list.)

Attempting test discovery results in:

[8/24/2017 12:35:06 PM Informational] ------ Discover test started ------
[8/24/2017 12:35:07 PM Error] System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at [email protected](a focusedState)
   at Microsoft.FSharp.Core.OptionModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpOption`1 option)
   at Expecto.Impl.testFromMember(MemberInfo mi)
   at [email protected](MemberInfo mi)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@165.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at [email protected](Type t)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@165.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at Expecto.Impl.testFromAssemblyWithFilter(FSharpFunc`2 typeFilter, Assembly a)
   at [email protected](Assembly a)
   at Discovery.DiscoverProxy.DiscoverTests(String source)
   at Discovery.DiscoverProxy.DiscoverTests(String source)
   at Discovery.Discoverer.Microsoft-VisualStudio-TestPlatform-ObjectModel-Adapter-ITestDiscoverer-DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
[8/24/2017 12:35:07 PM Informational] ========== Discover test finished: 0 found (0:00:00.7190687) ==========

jackfoxy avatar Aug 24 '17 19:08 jackfoxy

@jackfoxy - in this file https://github.com/jackfoxy/PSlogger/blob/master/tests/PSlogger.Tests/Tests.fs you actually have parametrized test list:

[<Tests>]
let testSimpleTests azureConnectionString =
    testList "write and read log record" [
        testCase "equality no optional" <| fun () ->
            let testDate = DateTime.UtcNow.AddDays(-7.)
            let inLog = {log1 with 

Not sure how it is possible to handle such tests in "Test Explorer" window. Should adapter skip such test lists?

alex-bogomaz avatar Sep 08 '17 11:09 alex-bogomaz

Perfect! Thanks, @alex-bogomaz Closing this issue @MNie

jackfoxy avatar Sep 09 '17 17:09 jackfoxy

@alex-bogomaz @MNie I closed this prematurely.

A better behavior would be to trap this exception, write a message that parameterized lists cannot be handled by the adapter, and continue to process the non-parameterized lists.

jackfoxy avatar Sep 09 '17 18:09 jackfoxy