mausch / Fuchu

Functional test library for F# / C# / VB.NET
Apache License 2.0
120 stars 22 forks source link

Config..ctor not found #47

Closed haf closed 8 years ago

haf commented 8 years ago

Upgrading to latest Fuchu + FsCheck yields:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Method 'Config..ctor' not found.
  at Suave.Tests.HttpVerbs.gets (Suave.SuaveConfig cfg) [0x00000] in /Users/h/dev/suave/suave/src/Suave.Tests/HttpVerbs.fs:22
  at at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00069] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/corlib/System.Reflection/MonoMethod.cs:238
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/corlib/System.Reflection/MethodBase.cs:114
  at Suave.Tests.FuchuExtensions+testFromMemberWithParam@15-1[Suave.Web+SuaveConfig].Invoke (System.Reflection.MemberInfo m) [0x00064] in /Users/h/dev/suave/suave/src/Suave.Tests/FuchuExtensions.fs:23
  at Microsoft.FSharp.Collections.ListModule.chooseAllAcc[MemberInfo,Test] (Microsoft.FSharp.Core.FSharpFunc`2 f, Microsoft.FSharp.Collections.FSharpList`1 xs, Microsoft.FSharp.Collections.FSharpList`1 acc) [0x00019] in <filename unknown>:0
  at Microsoft.FSharp.Collections.ListModule.Choose[MemberInfo,Test] (Microsoft.FSharp.Core.FSharpFunc`2 chooser, Microsoft.FSharp.Collections.FSharpList`1 list) [0x00008] in <filename unknown>:0
  at Suave.Tests.FuchuExtensions.testFromMemberWithParam[SuaveConfig] (Suave.SuaveConfig param, System.Reflection.MemberInfo m) [0x00000] in /Users/h/dev/suave/suave/src/Suave.Tests/FuchuExtensions.fs:30
  at Suave.Tests.FuchuExtensions+testFromTypeWithParam@45-1[Suave.Web+SuaveConfig].Invoke (System.Reflection.MemberInfo m) [0x00000] in /Users/h/dev/suave/suave/src/Suave.Tests/FuchuExtensions.fs:45
  at Microsoft.FSharp.Collections.IEnumerator+choose@154[Fuchu.Test,System.Reflection.MemberInfo].System-Collections-IEnumerator-MoveNext () [0x00064] in <filename unknown>:0
  at Microsoft.FSharp.Collections.SeqModule.ToList[Test] (IEnumerable`1 source) [0x00047] in <filename unknown>:0
  at Suave.Tests.FuchuExtensions+testFromTypeWithParam@40[Suave.Web+SuaveConfig].Invoke (System.Type t) [0x00000] in /Users/h/dev/suave/suave/src/Suave.Tests/FuchuExtensions.fs:41
  at Microsoft.FSharp.Collections.IEnumerator+choose@154[Fuchu.Test,System.Type].System-Collections-IEnumerator-MoveNext () [0x00064] in <filename unknown>:0
  at Microsoft.FSharp.Collections.SeqModule.ToList[Test] (IEnumerable`1 source) [0x00047] in <filename unknown>:0
  at Suave.Tests.FuchuExtensions.testFromAssemblyWithFilterAndParam[SuaveConfig] (Microsoft.FSharp.Core.FSharpFunc`2 typeFilter, System.Reflection.Assembly a, Suave.SuaveConfig param) [0x00000] in /Users/h/dev/suave/suave/src/Suave.Tests/FuchuExtensions.fs:51
  at Suave.Tests.FuchuExtensions.testFromAssemblyWithParam[SuaveConfig] (System.Reflection.Assembly asm, Suave.SuaveConfig param) [0x00000] in /Users/h/dev/suave/suave/src/Suave.Tests/FuchuExtensions.fs:59
  at Suave.Tests.FuchuExtensions.defaultMainThisAssemblyWithParam[SuaveConfig] (Suave.SuaveConfig param, System.String[] args) [0x00002] in /Users/h/dev/suave/suave/src/Suave.Tests/FuchuExtensions.fs:64
  at Suave.Tests.Program.main (System.String[] args) [0x000e7] in /Users/h/dev/suave/suave/src/Suave.Tests/Program.fs:27

Semi-blocking for https://github.com/SuaveIO/suave/pull/340 https://github.com/SuaveIO/suave/pull/334 (can solve by downgrading FsCheck, I think)

Possible source of the error:

let fsCheckConfig = { Config.Default with Arbitrary = [ typeof<Arbs> ] }

// later:

    testPropertyWithConfig fsCheckConfig "200 OK returns equivalent" <| fun respStr ->
      (runWithConfig (OK respStr) |> req HttpMethod.GET "/hello" None) = respStr

Versions:

 GROUP Tests
 FRAMEWORK: NET45
 NUGET
   remote: https://nuget.org/api/v2
   specs:
     FsCheck (2.2.2)
       FSharp.Core (>= 3.1.2.5)
     FSharp.Charting (0.90.13)
     FSharp.Core (3.1.2.5)
     Fuchu (1.0.1)
       FSharp.Core (>= 3.1.2.1)
     Fuchu.FsCheck (1.0.1.0)
       FsCheck (>= 2.1.0)
       FSharp.Core (>= 3.1.2.5)
       Fuchu (>= 1.0.1.0)
     Fuchu.PerfUtil (1.0.1.0)
       FSharp.Core (>= 3.1.2.1)
       Fuchu (>= 1.0.1.0)
       PerfUtil (>= 0.1.8)
     Http.fs-prerelease (2.4.0)
       FSharp.Core (>= 3.1.2.1)
     PerfUtil (0.1.8)
     WebSocketSharp (1.0.3-rc9)

Has @fscheck an API breakage in a minor release? /cc @kurtschelfthout

Repro commit: https://github.com/SuaveIO/suave/commit/c30f57473c6b59a4aa77fec8461302660c430d20

mausch commented 8 years ago

Seems like the breaking change was https://github.com/fscheck/FsCheck/commit/b9da333ff283fa5ae26623946781d809e6d7dcda#diff-fae3712c738f2860b54d6ce6f880b74aR63 i.e. adding a member to a record type

mausch commented 8 years ago

Upgraded to FsCheck 2.2.2 and pushed 1.0.2

kurtschelfthout commented 8 years ago

Sorry - did not occur to me at the time of merging that change…

haf commented 8 years ago

No worries, thanks for fixing it so fast @mausch !