FSharpTest: F# VS Test Project Template

Update Nov. 30, 2013: v1.2 adds VS 2013 support.

Update Nov. 10, 2013: v1.1 adds links to documentation (and just realized I forgot link to NUnit docs) and more samples of FsUnit and FsCheck, including stateful testing.

I finally did something about scratching an itch I’ve had for some time, that is to create an F# test project template, and I have released it upon the world as FSharpTest. No more fumbling around installing all the NuGet packages and opening another of my projects to see how to implement model test cases when I want to add a test project to a Visual Studio solution .

The Components

NUnit is my “go to” test framework and FsUnit lets me write test assertions in a more fluent composeable style. FsCheck and Unquote round-out the template with failing test case examples.

This is a first release to get community feedback, so let me know what you think. It occurred to me I don’t have a sample test case of FsUnit at work, and I should have added links to all the included test tool docs in the code comments, something for the next release. I also want to add more FsCheck technique examples including Stateful Testing and include TickSpec, as soon as I become familiar with that tool.

The available F# testing tools are really first class and I hope this makes it easier and faster for people to bring up tests.

Under the Covers

If you want to create your own distributable VS extension you will need to install the Visual Studio SDK. Here is the article on how to create project templates and you will find the template parameters reference helpful as well.

A template is a handy thing, but if you want to share it you need to wrap it in an
installable project template extension by using the VSIX project template. The steps in this article are pretty complete, but I never did find the “Content” section it talks about, and it doesn’t explicitly explain you have to add the template zip file to the project through the “Assets” tab.

Hackit Yurself

You can actually hack-up a VSIX file by changing its file type to “zip” and editing the contents. In fact that’s mostly how I crafted the entire template. Once you create the original template zip just edit the files and add NuGet packages in the root.

Now that you know that secret you can modify this extension to your own liking, but do let me know how you customize it so I can benefit too and consider putting the changes in future releases.

One thought on “FSharpTest: F# VS Test Project Template

  1. Pingback: F# Weekly #42, 2013 | Sergey Tihon's Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>