10 TestCentre Breakdown
Craig Oates edited this page 4 years ago

This project is a traditional .Net (4.7) library, written in F#. Its main purpose is to house the solution's unit and property tests.

Within the project, you will see six files and one folder. Although, you should only need to work with two of them. They are "ConsoleTests.fs" and "LibraryTests.fs".

testcentre selected

The "AssemblyInfo.fs", "TestCentre.fsproj" and "packages.config" files are all standard files. You will find them in most, if not all, F# based (traditional) .Net libraries.

"Script.fsx" contains code I will go over a little later. Although, if you know how to work F# Interactive (FSI), you will already know how to use this file. There is not much code in it and you can avoid using at all it if you want.

testcentre file structure

As there names imply, "ConsoleTests.fs" and "LibraryTests.fs" houses the tests of their project's namesake. So, "ConsoleTests.fs" contains the tests for the console (SmoulderingBeachBallCLI) project. And, "LibraryTests.fs" contains the tests for the library project (SmoulderingBeachBall).

testcentre split overview

The folder ("SavingTestArea"), provides an area for TestCentre to actually save the images it produces. If you do not see it in your solution, you might need to create it yourself. This will become clear when you run the tests, because they will fail. If you need to add "SavingTestArea" to your copy of TestCentre, make sure it matches the location in the above diagram.

As stated above, there is a F# script file included in TestCentre. For the most part, you should never need to use it. The main purpose of it is to provide a place for "throw away" code.

At this moment in time, "Script.fsx" provides code for you to delete any/all files in the "SavingTestArea" folder. With that said, you should only need to use it if the images are not deleted after running the unit/property tests. If that is the case, that usually means there is a problem with the tests or the projects they are testing. Either way, you should look into it.

If you are unfamiliar with using F# scripts and F# Interactive (FSI), please use the following links: