haf / expecto

A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Apache License 2.0
663 stars 96 forks source link

dotnet test on new project built from template fails to run #318

Closed MarneeDear closed 5 years ago

MarneeDear commented 5 years ago

I get this error when I dotnet test on a new Expecto project:

Starting test execution, please wait... An exception occurred while invoking executor 'executor://yolodev/expecto': Method not found: 'Void ExpectoConfig..ctor(Boolean, Int32, Microsoft.FSharp.Core.FSharpOption1<System.TimeSpan>, System.TimeSpan, Double, Boolean, Microsoft.FSharp.Core.FSharpFunc2<Expecto.Test,Expecto.Test>, TestPrinters, Expecto.Logging.LogLevel, Microsoft.FSharp.Core.FSharpOption1<System.String>, Microsoft.FSharp.Core.FSharpFunc2<Expecto.TestCode,Expecto.SourceLocation>, Int32, Int32, Microsoft.FSharp.Core.FSharpOption`1, Boolean, Boolean, Boolean)'.

Steps:

Create a new expecto project

dotnet new expecto

Build the project

dotnet build

Build runs, does a restore, there are no errors.

Run the tests.

dotnet test

Get this error:

Starting test execution, please wait... An exception occurred while invoking executor 'executor://yolodev/expecto': Method not found: 'Void ExpectoConfig..ctor(Boolean, Int32, Microsoft.FSharp.Core.FSharpOption1<System.TimeSpan>, System.TimeSpan, Double, Boolean, Microsoft.FSharp.Core.FSharpFunc2<Expecto.Test,Expecto.Test>, TestPrinters, Expecto.Logging.LogLevel, Microsoft.FSharp.Core.FSharpOption1<System.String>, Microsoft.FSharp.Core.FSharpFunc2<Expecto.TestCode,Expecto.SourceLocation>, Int32, Int32, Microsoft.FSharp.Core.FSharpOption`1, Boolean, Boolean, Boolean)'.

My dotnet --info

$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.105
 Commit:    7cecb35b92

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.105\

Host (useful for support):
  Version: 2.2.3
  Commit:  6b8ad509b6

.NET Core SDKs installed:
  2.1.300 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.2.101 [C:\Program Files\dotnet\sdk]
  2.2.105 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

I also reported this on the template project: https://github.com/MNie/Expecto.Template/issues/14

haf commented 5 years ago

dotnet run?

MarneeDear commented 5 years ago

I had to go back to version 8.9.1 to get the tests to run. In the fsproj from the expecto template the Expecto version is set to this:

<PackageReference Include="Expecto" Version="8.*" />

Maybe versions 8.10+ are not compatible with the Yolo test runner specified in the template's fsproj.

<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.*" />

AnthonyLloyd commented 5 years ago

Or I think it may be https://github.com/YoloDev/YoloDev.Expecto.TestSdk you need to report it on. I'm not sure.

haf commented 5 years ago

@MarneeDear Happy to have you as a user! I hope you can power through the SDK issue ;)

MarneeDear commented 5 years ago

@haf dotnet run did work.

MarneeDear commented 5 years ago

@haf I'll see what I can do.

AnthonyLloyd commented 5 years ago

@MarneeDear sorry for closing so quickly. You can use Expecto without the template and test SDK.

In the past they have been hard to keep aligned. This may be better in future as the command line config they use has been changed to more backwardly compatible format.

MarneeDear commented 5 years ago

I opened an issue with YoloDev. Looks like he has an idea of how to fix it.

https://github.com/YoloDev/YoloDev.Expecto.TestSdk/issues/15