Create fsharp test projects from scratch
About
This is a quick breakdown study I did to understand the automation behind F# test projects.
Breakdown
Creating a test project the typical way
This article from Microsoft goes through the process of creating a .sln with
two projects: the source and test projects.
For this study, it's not strictly necessary so I'll only be creating the test projects.
tempdir=$(mktemp -d); cd ${tempdir}
dotnet new xunit -lang 'F#'
From there on, simply running dotnet test will correctly run the sample test
in Tests.fs
Creating a test project from a console application
These are the commands to hack a console-based application into a testing project.
There are a few warnings when running dotnet test, but that is expected as
we've basically MacGyver'ed an source project into a test project.
tempdir=$(mktemp -d); cd ${tempdir}
dotnet new console -lang 'F#'
# add unit testing tool
dotnet add package xunit
# add microsoft testing sdk
dotnet add package Microsoft.NET.Test.Sdk
dotnet add package xunit.runner.visualstudioConclusion
I'm hoping this breakdown will give me some insight on the plumbing happening behind dotnet's testing framework.