7 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.

testcentre selected

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

testcentre file structure

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-Sharp Interactive (FSI), you will already know how to use this file. There is not much code in it and you can avoid using it at all it if you want. As their names imply, "ConsoleTests.fs" and "LibraryTests.fs" houses the tests of their project's namesake. So, "ConsoleTests.fs" contains the tests for the console (CLI) project. And, "LibraryTests.fs" contains the tests for the (.Net Standard) library project.

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. Alongside "SavingTestArea" is its counterpart, "LoadingTestArea". This is where TestCentre loads the pre-made images from to test DeathSocket's ability to add the overlays to them. Within "LoadingTestArea" is another folder called "RequiredInfo" which contains files which some tests rely on for them to pass. An example of some of the things these tests rely on is an image having certain dimensions. Usually, TestCentre generates random images to test against which means you cannot reliably check the dimensions of an image. So, do not delete the images in "RequiredInfo".

As stated above, there is a script file called "Script.fsx" included in TestCentre. The main features it provides are a way to run some of the functions in the UnitTests and PropertyTests modules in isolation and populating/resetting "LoadingTestArea" and "SavingTestArea". Before running any of the code in "Script.fsx", you will need to build the solution.

If you find any of your tests failing, cross-reference the names of the failing tests with any of the functions in "Script.fsx" to see if they can help. The most likely one is createSavingTestArea.

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