Fsharp: Visual Studio live testing not working with F#

Created on 19 Nov 2016  路  18Comments  路  Source: dotnet/fsharp

_edit by @cartermp_

NCrunch is a third-party alternative to Live Unit Testing that supports F# tests, see here: https://github.com/Microsoft/visualfsharp/issues/1784#issuecomment-487429623

--

Original issue:

According to twitter discussions the new ncrunch-like live testing feature in visual Studio 2017 is not working with F#. That would be really a shame if that is the case on RTM.

Area-External Area-IDE Language Service Feature Request

Most helpful comment

@cartermp . Initial target was C#/VB with .NET Framework and 3 test frameworks of nunit, xunit and mstest. Other languages, other frameworks, feature enhancements are in the backlog, which we need to prioritize. Thanks for the feedback on F#.

All 18 comments

Best chance at this is probably ionide (example is code lense which is dying on uservoice)... Maybe if we ask @Krzysztof-Cieslak nicely ;)

On the other hand: Does this even support anything but mstest? If it doesn't, it might not be as usable as we think.

https://blogs.msdn.microsoft.com/visualstudio/2016/11/18/live-unit-testing-visual-studio-2017-rc/ says nunit, xunit and mstest.

Since ncrunch works well with F# I assume it's "just" a matter of Microsoft assigning a good developer on that topic. ;-)

Why care about MSFT? There is community based project trying to do it, just needs some better support from community and contributors: https://github.com/parthopdas/tddstud10-vscode

@Krzysztof-Cieslak Thanks for pointing to those projects.
@forki Thanks for the link.

Ok so this sounds "doable". Maybe it comes "for free" with the roslyn integration?

cc @morrisjoe for LUT and F#

@matthid nothing is for free - not even if we have roslyn.

@cartermp . Initial target was C#/VB with .NET Framework and 3 test frameworks of nunit, xunit and mstest. Other languages, other frameworks, feature enhancements are in the backlog, which we need to prioritize. Thanks for the feedback on F#.

@morrisjoe I know many devs in the F# community that really use ncrunch a lot. So I assume it's what you want to try next. Also there are many mixed F#/C# solutions out there (where tests are often written in F#) and it would be weird to have that break.

This is external. @morrisjoe do you have a tracking bug we can link to for the feature request for your team? thanks

Any updates on this?

@dsyme Let's re-open since there is a component to this that we'd have to do.

My understanding is that LUT basically asks the language service to yield back syntax nodes that it can instrument. That would make it a service similar to breakpoint resolution.

@KevinH-MS Happy to chat in the office next week about this, but off hand would you have an estimate of the work it would take to get LUT instrumentation to understand what we'd yield back?

Ping!

Sorry for double posting but, I just want to highlight importance of this for F# adoption.

As you know F# has already excellent testing libraries. But to give you an example from F# adoption point of view, I am leading a team of developers, and writing our tests in F# would be a good entry point to the language for my team. However, doing so we have to give up the live unit testing facility which is also very useful for us. If this feature is implemented nothing will stop us from using F#.

@OnurGumus while I'd love to see MS invest in things like that, I don't really think these teams make that a priority.

You have good alternatives:

@forki I didn't know about ncrunch. That might actually fit to our needs. Neptune is also nice though we use Visual Studio.

I'm using NCrunch with F#, and it works quite well. Well worth the investment. NCrunch's parallel execution is quite nice, as is the console output. I can drop a printfn where I wanna see a variable's value, and it'll appear in the sidebar.

image

Video: https://thumbs.gfycat.com/PortlyPeskyAsiaticlesserfreshwaterclam.webp

@dharmaturtle Thanks! I've updated the original post so that if other folks run into this, they can see your post easier.

Was this page helpful?
0 / 5 - 0 ratings