Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MSTest with F#

Is it possible to use MSTest with F# in VS2010. People has asked this question many times. But I can't seem to find a solution among the answers. Has anybody been able to use MSTest for F# unit testing or should I stick to NUnit?

like image 978
amirmonshi Avatar asked Feb 24 '11 11:02

amirmonshi


1 Answers

Yes, you can use MsTest with F# in VS2010. At the most basic level, using the [<TestClass>], [<TestMethod>] and related attributes will allow you to run tests from the command line using mstest (in a VS command prompt window). In addition, if you use the trick described here: http://www.atrevido.net/blog/2010/05/07/F+Unit+Testing+With+Visual+Studio+2010.aspx, you will be able to use about 95% of the VS2010 support for unit tests.

In particular, you can use the Test List Editor, run tests from VS2010 in normal or debug mode, and view test results within VS2010.

If supported by your VS2010 edition, code coverage will also work for F# unit tests.

One feature that doesn't work is navigating to the source of a unit test by double-clicking on the test from the test result viewer.

I've also been able to combine MSTest and FsCheck tests.

like image 199
fmr Avatar answered Sep 30 '22 03:09

fmr