Using MSTest with F#

孤人 提交于 2019-12-10 13:32:54

问题


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?


回答1:


I think you should stick to NUnit. Have a look here: http://connect.microsoft.com/VisualStudio/feedback/details/564586/make-using-mstest-more-accessible-to-f-projects. There is no progress with that issue.




回答2:


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.




回答3:


A more up to date answer (unless still constrained to vs2010) would include

  • FsUnit
  • Unquote

I've got Unquote working with MsTest via Daniel Mohl's mstest template

Although I have no idea if any or all of these would work against vs 2010



来源:https://stackoverflow.com/questions/5103964/using-mstest-with-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!