Evaluation Testing frameworks
React/Javascript
Requirements
- Ease of use, the setup and configuration of unit tests should not be overly complicated.
- It should be actively maintained and preferably a large user group as to not wind up abandoned.
- It would be preferable if the testing framework was included in npm.
Jest
Jest minimizes the need for external dependencies and requires little setup, making it easy to get started with testing. It enables developers to write simple, maintainable unit tests and is effective for regression testing, as it quickly detects changes in the codebase. By rerunning tests after modifying the code, developers can immediately verify whether everything is functioning as expected. There are many libraries available for front-end testing. Jest stands out due to its ease of use, speed and features. It is highly popular, actively maintained and remains a relevant choice for modern testing. The reliability of tests written in Jest also allows them to serve as a form of documentation.
Mocha
Mocha is another popular testing framework, but it requires more configuration and can be more complex to set up. With Mocha, developers must choose and integrate additional tools and libraries themselves, while Jest provides the essential tools and libraries the developer needs up front.
Jasmine
Jasmine is also an option, but it often involves a more complex setup. Additionally, handling asynchronous testing can be more challenging.
Conclusion
Since Jest seems to be easy to setup, is actively maintained and introduces no further dependencies. We have decided that it is the best choice for React/Javascript testing.
C#
Requirements
- Ease of use, the setup and configuration of unit tests should not be overly complicated.
- It should be actively maintained and preferably a large user group as to not wind up abandoned.
- It would be preferable if the testing framework was included in dotnet.
MSTest
Microsoft test framework for all .NET languages. It's extensible and works with .NET CLI, Visual Studio, Visual Studio Code, and Rider. It supports both VSTest and Microsoft.Testing.Platform. According to Microsoft.
MSTest is a testing framework supported by Microsoft. It is used for unit testing. MSTest integrates well with Visual Studio and is often used in enterprise environments. According to BrowserStack.
Pros:
- Open-source
- A good option for enterprise projects
- Supports data-driven tests
- Comes with cross-platform support
Cons:
- Lacks advanced assertions in comparison with NUnit and xUnit
- Execution is slightly slower
- Not really flexible in test case organization
NUnit
Unit-testing framework for all .NET languages. Initially, NUnit was ported from JUnit, and the current production release has been rewritten with many new features and support for a wide range of .NET platforms. It's a project of the .NET Foundation. It supports both VSTest and Microsoft.Testing.Platform. According to Microsoft.
NUnit is one of the most popular testing frameworks for C#. It enables test-driven development (TDD), assertions for validation, and easy integration with CI/CD pipelines. It provides robust test execution, reporting, and supports parameterized tests for comprehensive test coverage. It integrates seamlessly with CI/CD pipelines, providing detailed test reports. NUnit offers different assertions, supports asynchronous test execution, and test parameterization. According to BrowserStack.
Pros:
- Feature-rich with better assertion functionalities
- Supports parallel tests
- Enables parameterized tests with [TestCase]
Cons:
- Slows down due to setup/teardown mechanisms
- Needs additiop for Visunal setual Studio integration
xUnit.net
Free, open-source, community-focused unit testing tool for .NET. The original inventor of NUnit v2 wrote xUnit.net. xUnit.net is the latest technology for unit testing .NET apps. It also works with ReSharper, CodeRush, and TestDriven.NET. xUnit.net is a project of the .NET Foundation and operates under its code of conduct. It supports both VSTest and Microsoft.Testing.Platform. According to Microsoft.
xUnit is a popular, modern unit testing framework for C# that is designed with simplicity and extensibility in mind. It is particularly well-suited for .NET Core and .NET 5+ applications, although it also supports .NET Framework. It encourages clean, maintainable test code and supports modern .NET features. It integrates well with CI/CD pipelines and provides comprehensive test execution reports. xUnit is widely adopted due to its flexibility, minimalistic approach, and strong community support within the .NET ecosystem. According to BrowserStack.
Pros:
- Enables enhanced test isolation and execution speed
- Supports parallel test execution
- Faster execution compared to its counterparts
Cons:
- Steep learning curve
- No built-in test case metadata
- Lesser built-in features
Comparison
An comparison table according to BrowserStack.
| Feature | MSTest | NUnit | xUnit |
|---|---|---|---|
| Test class | [TestClass] | [TestFixture] | NA |
| Test Method | [TestMethod] | [Test] | [Fact] |
| Initialization | [TestInitialize] | [Setup] | NA(constructor of the class is used for initialization) |
| Data driven test method | [DataTestMethod] | NA | [Theory] |
| Add parameters | [DataRow( _ , _)] | [TestCase( _ , _)] | [InlineData( _ , _)] |
| Documentation | Well Documented | Well Documented | Doesn't have good documentation |
| Tests Isolation | By default | Can be configured | By default |
Conclusion
Even though xUnit might be harder to use, it is a big backed industry standard that is unlikely to be abandoned anytime soon. With Microsoft using and developing it, we feel it's a safe bet.
1. Setup
2. Standards
- Coding Conventions
- Issues
- Branch creation
- Reviews
- Implementation Standards
- [WIP] Creating new databases
- Localization
3. Models and Diagrams
4. Testing
5. Documentation
- Documentation for service endpoints
- API documentation
- Webpage Design
- Secrets and .env
- Evaluations
- Installation and Rebuild script documentation
6. Guides and How-to's
7. Micro Service Mockup Api
- Guidelines Mircro Service Mockup
- Documentation of useTemperature/useTemperatureTimeSeries mockup sensor