Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests not being picked up by Visual Studio #6

Open
Arrow7000 opened this issue Mar 20, 2019 · 9 comments
Open

Tests not being picked up by Visual Studio #6

Arrow7000 opened this issue Mar 20, 2019 · 9 comments
Milestone

Comments

@Arrow7000
Copy link

Arrow7000 commented Mar 20, 2019

Hi, I'm pretty new to the .NET world but my tests are not being picked up by VS. I've tried it in both VS2017 and VS2019 Preview.

I'm using .NET Core 2.1.

This is my test, copied straight from the Fuchu docs:

open Fuchu

let simpleTest = 
    testCase "A simple test" <| 
        fun _ -> Assert.Equal("2+2", 4, 2+2)

I have installed both Fuchu and Fuchu.Adapter via Nuget into my test project. Other tests I've got using XUnit and UnQuote are being picked up and run fine.

Am I missing anything?

@Arrow7000
Copy link
Author

@idg10 would you be able to help?

@idg10
Copy link
Contributor

idg10 commented Apr 2, 2019

Hi, sorry, I somehow missed the original notification. I'll take a look. I've not been able to use F# in production for a while, so I've not actually looked at this for some time. It's quite possible that it just doesn't work right now with .NET Core 2.1. Will look at it now.

@idg10
Copy link
Contributor

idg10 commented Apr 2, 2019

OK, a couple of things:

  1. I don't think Fuchu itself supports .NET Core. The NuGet package doesn't explicitly declare its target frameworks but if you look inside the Fuchu.dll in the package's lib folder, it includes a [TargetFrameworkAttribute("NETFramework,Version=v4.0", FrameworkDisplayName=.NET Framework 4 ]`
  2. As far as I know, Fuchu's test discover mechanism requires tests to be prefixed with a [] attribute.

To deal with 1, you'll need to change your project's target framework to some version of .NET Framework, rather than .NET Core, e.g., change your test project .fsproj so that it contains this:

<TargetFramework>net472</TargetFramework>

Also, modify your test thus:

open Fuchu

[<Tests>]
let simpleTest = 
    testCase "A simple test" <| 
        fun _ -> Assert.Equal("2+2", 4, 2+2)

However, that alone won't be enough, because it appears that my test adapter is encountering exceptions from the 'Cecil` library it uses, and I've not yet worked out why.

@wallymathieu
Copy link

The library has very few dependencies. It supports dotnet core as can be seen here: https://github.com/mausch/Fuchu/blob/master/Fuchu/Fuchu.fsproj#L4

@idg10
Copy link
Contributor

idg10 commented Nov 27, 2019

The version on NuGet doesn't.

That file in GitHub didn't support it at the time I wrote the earlier comment - it looks like you added support for .NET Standard 2.0 about 3 weeks after I wrote that comment, which is great, but until that change makes it out to a version accessible through NuGet I don't think I can do anything.

@wallymathieu
Copy link

Let's fix that then. 😄

@wallymathieu
Copy link

Is this better: https://www.nuget.org/packages/Fuchu/1.1.0 ?

@idg10
Copy link
Contributor

idg10 commented Dec 2, 2020

OK, and only slightly over a year later there's a preview. Fuchu.Adapter 2.0.0-preview.4 is now up on NuGet (well, it's "validating" right now, but should be visible soon) and works with modern-style projects.

More work is required before we can get to a non-preview release. (It currently spews out a lot of debug info into the Test Output window, and there's also #11 to be dealt with, for example. And also quite a lot of TODOs in the code.) But basic support for .NET Core, and building on current versions of things is in place.

@wallymathieu
Copy link

That's cool!

@idg10 idg10 added this to the v2.0 milestone Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants