13

I've defined the following F# file:

module MyFsTest

open NUnit.Framework
open FsUnit

[<Test>]
let ``1 + 1 = 2``() = Assert.AreEqual(2, 1+1)

yet when I try to run them either through "Test Explorer" or "Right Click + Run Tests" a build is done yet no tests are detected/run:

------ Discover test started ------
========== Discover test finished: 0 found (0:00:00,0320018) ==========

After googling a bit I've found my approach seems to resemble the steps taken @ http://davesquared.net/2013/03/hello-world-testing-in-fsharp.html, so I was wondering if there's something else I might be missing?

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
  • Can you rule in/out whether you have a NUnit runner plugin for VS (and/or its version)? Do C# test get discovered / run (I doubt ti as there doesn't seem to be anything obviously wrong) ? – Ruben Bartelink Feb 01 '14 at 23:41
  • @RubenBartelink: That was it. I didn't have a NUnit plugin installed. But looking at the VS Gallery, there seems to be no version supporting VS2013 yet :(. – devoured elysium Feb 02 '14 at 01:44
  • 1
    It seems there is no way to get it to work with an express edition: http://stackoverflow.com/questions/20907842/how-to-install-nunit-plugin-in-visual-studio-2013-express – devoured elysium Feb 02 '14 at 02:16

1 Answers1

11

To use NUnit tests with the built-in Visual Studio test runner, you'd need to install the NUnit test adapter. This is available for Visual Studio 2013, but I believe it is not possible to install it as an extension to the Express edition.

However, the Express edition includes support for the Microsoft Visual Studio testing framework, which is supported by the built-in test runner. The usage should be pretty similar to NUnit - you'll just need different namespaces.

Tomas Petricek
  • 240,744
  • 19
  • 378
  • 553
  • 1
    Why does 'Ctrl + U + R' in the test method not work? I have Resharper installed and when I use the short-cut within the method Resharper simply says "No tests found in the file". However if I go to the test project and right click choosing Run Tests, the tests will be run, namely Ctrl + U + R works on the test project but not the test file. In C# it works on both. Is this a Resharper plugin problem? – dragonfly02 Dec 21 '15 at 10:58
  • You might need a [newer version](https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.NUnit3TestAdapter) of the NUnit Test Adapter. – Edward Brey Dec 09 '16 at 21:23