-
Notifications
You must be signed in to change notification settings - Fork 1
Testing
This page contains information on how to run tests, and where tests are located. For more information about the folder structure checkout the folder structure page
Run the test suite with
dotnet test
All tests are located in /BackendTests/
.
This project uses NUnit, a unit-testing framework for all .Net languages. NUnits own documentation is available on their documentation page.
-
What does the backend testing cover?
-
In short: What is our purpose of doing testing?
This projects sees to serve as a man-in-the middle between Open Data sources and end-users. It is therefore critical that data being processed and displayed are correct in value and type. Writing tests is on way of assuring that these properties are maintained at entry, during processing and at exit.
When testing, we can either access the relevant API's with regular HTTP requests, or use fake data (mocking). We use a mocking tool called "Bogus" to create this fake data.
The application decides whether or not to use real data during runtime, by checking a configuration variable called "MockRequests". This check can be found in the Startup.cs file, and looks like this:
Configuration.GetValue<bool>("MockRequests")
The correct services are then applied to the application, and it runs with either real or mocked data.
SINTEF AS 2021