-
Notifications
You must be signed in to change notification settings - Fork 0
Unit Tests
Unit Tests are an essential part of any application. This document will provide an overview of the Unit Testing used by Hello-World.
NUnit 3 was decided as the best Unit Test project for Hello-World, after the following options were considered:
- xUnit
- NUnit 3
- MSTest
- Unit Test Project (.NET Framework)
Sources:
Questions:
Can we run .NET Framework Unit Tests for our .NET 8 application?
Answer: Technically, yes, but it is not recommended. This disqualifies option 4.
xUnit: open source, simple, extensible, with high community support, a research-focused naming scheme ("Theory", "Fact"), and built for parallel execution. This would be best for a small, modern application.
NUnit: open source, more robust, but with more familiar syntax and tags for set up and tear down. This would be best for a more robust application.
MSTest: microsoft's built-in unit tests with the syntax I'll be most familiar with ("TestMethod", "TestInitialize") that comes integrated in Visual Studio. This would be best for a team heavily invested in Microsoft.
The values most important to me in this decision are 1. time to implement and 2. learning something new. Because of that, I've decided to use NUnit. While xUnit is the most unknown to me (which would be a great learning opportunity), NUnit will be different enough to justify learning something new. While MSTest is the fastest to implement due to my familiarity, it provides no opportunity to learn. NUnit may more robust than necessary for such a small project, but it will reduce the learning overhead that would come with xUnit's parallelized execution and new naming fulfilling the goal of reducing time to implement. NUnit 3 is the "Goldilocks" option for both values. While I'd like to revisit xUnit in the future, I will develop Hello-World's unit tests in NUnit 3.