Reputation: 90465
I'm new to F# and I intend to create new F# project, and unit test it with F# in Visual Studio 2008, but the Visual Studio 2008 Unit Test Wizard don't have a F# test project option (just have C, C# and VB options).
Upvotes: 4
Views: 1232
Reputation: 66531
I'm not sure whether this is strictly related to your exact question, but there are a whole series of posts on Matthew Podwysocki's blog about unit testing in functional languages - there are some F# bits in there too.
Upvotes: 3
Reputation: 10006
This link describes using the VS testing system with F#. You do it pretty much the same way as with C#.
The downside is that apparently the VS IDE won't automatically pick it up -- I believe you need to run from the command line using mstest.exe.
Edit: Oh, another cool thing with F#, is FsCheck. This allows you to write simple tests, and have the FsCheck system try to disprove them via random testing.
Upvotes: 4
Reputation: 49179
Upvotes: 4
Reputation: 16505
There's nothing forcing you to use F# to test F#. You could simply create a unit test assembly in C#, VB or another .NET supported language, and simply reference the F# assembly needed to perform the tests. You would do it just as you would create unit tests for any other .NET assembly.
Upvotes: 3
Reputation: 35107
Are you asking if it's possible to unit test in F# or are you asking if there's a wizard for it? It's possible to unit test in any language, in fact, functional languages are a unit testers wet dream (I heard it described that way.) since everything is static and you've verified all the edge cases you've essentially verified every case.
EDIT: To answer the fourth question, write your own test cases:
http://en.wikipedia.org/wiki/Unit_testing
Upvotes: 2
Reputation: 23820
I found this article on f# testing with nunit (link here). I do remember however that there's another way to verify the validity of functional language code (I 'worked' with Clean, which is similar to Haskell for my bachelor). Just can't remember exactly what they called it, I do remember it's more like a mathematical proof. Also, I'm not sure that it works for F#, as it's a bit different from Haskell'esque languages if I read that correctly.
Upvotes: 4