Book Image

Testing with F#

By : Mikael Lundin
Book Image

Testing with F#

By: Mikael Lundin

Overview of this book

Table of Contents (17 chapters)
Testing with F#
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

FAKE


The point of being able to run tests outside Visual Studio is not something you will have to do very often, but it is an absolute requirement to run your tests in a build script.

FAKE is a build automation system similar to the make of C and the rake of Ruby, featuring F# with a specific Domain Specific Language (DSL) to set up build scripts fast and easy.

To get started, install the NuGet package for FAKE in your solution. You don't have to add it to any particular project. This is shown in the following screenshot:

The package will install itself on the solution directory path, packages\FAKE.3.5.5\tools. Now, in the solution level, create a new F# script file called build.fsx:

// define includes
#I @"packages/FAKE.3.5.5/tools/"
#r @"FakeLib.dll"
open Fake
open Fake.FileUtils

// constants
let buildDir = "./build"
let deployDir = "./deploy"

// define targets
Target "Clean" (fun _ ->
    CleanDirs [buildDir; deployDir]
)

// define dependencies

// execute
Run "Clean"

The only thing...