SaaSHub helps you find the best software and product alternatives Learn more →
Top 23 C# Testing Projects
-
Bogus
:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
That reminds me of Bogus which also generates dummy data that I've been using for sometime now.
-
Several well-known NuGet packages such as xUnit.net, FluentAssertions, StyleCop, Entity Framework Core, and others include by default a significant number of Roslyn analyzers. They help you adhere to the conventions and best practices of these libraries.
-
InfluxDB
Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.
-
Fluent Assertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, as well as .NET Core 2.1, .NET Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
Project mention: Integration tests without API dependencies with ASP.NET Core and WireMock.Net | dev.to | 2022-12-20 -
testcontainers-dotnet
A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
Project mention: Integration tests with AWS S3 buckets using Localstack and Testcontainers | dev.to | 2023-11-07Testcontainers
-
AutoFixture
AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximize maintainability. Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data.
Our first test is very easy, I like to name my tests as MethodName_GivenCondition_ShouldExpectedResult to follow the pattern, I have added GetById_GivenRecordDoesNotExist_ShouldReturnNull and I am going to leavarage excellent AutoFixture to get a new Guid as parameter. For this test we don't need arrange part, we would skip to the act and then assert. For Assertion I am going to use FluentAssertions. For this test we need to assert the returned result is null.
-
a. you might do so purely out of argo cult, i.e. because someone told you this was the right thing to do™, and that's a silly exercise. b. you could also be doing this for a good reason: to use the interface with a mocking tool like NSubstitute
-
Project mention: CI/CD Pipeline Using GitHub Actions: Automate Software Delivery | dev.to | 2023-07-21
.NET / xUnit / NUnit / MSTest
-
Onboard AI
Learn any GitHub repo in 59 seconds. Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.
-
ReportGenerator
ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
I am trying to install ReportGenerator through PowerShell. My understanding from installation page is that I will need NuGet in order to do this.
-
Verify
Verify is a snapshot tool that simplifies the assertion of complex data models and documents.
Bogus - For creating fake data Verify - Snapshot testing for .NET MELT - For testing ILogger usage Stryker - Mutation Testing for .NET TestContainers - run docker programmatically in integration tests
-
SpecFlow
#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
You can also try posting an issue to the SpecFlow GitHub repo. That sometimes gets me an answer. And when all else fails, I just bite the bullet and post to Stack Overflow.
-
On a side note, something I would highly recommend NOT doing is using the built in assertion types for any of the test adapters. Without a doubt the hardest part of switching unit test frameworks is having to fix all your assertions which is why we use 3rd party assertions. The built-in assertions also tend to not be very feature rich and don't have the most helpful messages. We personally use FluentAssertions, but there are other options such as Shoudly or Should. I highly recommend picking one of them over the built in assertions. You will thank yourself later :)
-
Project mention: [WPF, C#] Need ideas on how to automate these operations based on the response I get from python script. | /r/dotnet | 2023-06-09
If you are looking to automate this all through the GUI of each app involved then I suggest using FlaUI or some other wrapper around UIA
-
Project mention: Stryker.NET alternatives - Testura.Mutation, visualmutator, fettle, and Faultify | libhunt.com/r/stryker-net | 2023-06-09
-
-
mockhttp
Testing layer for Microsoft's HttpClient library. Create canned responses using a fluent API.
I'd say that without wanting to refactor the code a little bit (maybe moving those HttpClients into a service so that they are easily mocked) your best bet would be to use something like WireMock or MockHttp.
-
System.IO.Abstractions
Just like System.Web.Abstractions, but for System.IO. Yay for testable IO access!
-
coyote
Coyote is a library and tool for testing concurrent C# code and deterministically reproducing bugs.
Project mention: Implementing a distributed key-value store on top of implementing Raft in Go | news.ycombinator.com | 2023-05-25Microsoft has a library/tool called Coyote* that helps with testing distributed systems; you can write tests/specifications, Coyote will systematically explore nondeterminism in your system and check if your tests still pass. If there's a failure, it'll show the sequence of events that led to the failing test.
I started a project to implement Raft with a KV-store on top, similar to the article, meaning to use Coyote to test it; I didn't get that far before losing interest, though. It's reassuring to read that it took Phil several months to write the code in the post, it's good to know that this is a decidedly nontrivial problem.
-
WireMock.Net
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
I'd say that without wanting to refactor the code a little bit (maybe moving those HttpClients into a service so that they are easily mocked) your best bet would be to use something like WireMock or MockHttp.
-
Project mention: Can I set a policy (using `editorconfig`?) to require certain namespace aliases? | /r/dotnet | 2023-08-18
Since this happens at the code level (the alias no longer exists at compile time), I probably can't use something like https://github.com/BenMorris/NetArchTest to test for this.
-
-
Compare-Net-Objects
What you have been waiting for :+1: Perform a deep compare of any two .NET objects using reflection. Shows the differences between the two objects.
-
Machine.Specifications
Machine.Specifications is a Context/Specification framework for .NET that removes language noise and simplifies tests.
-
vstest
Visual Studio Test Platform is the runner and engine that powers test explorer and vstest.console.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
C# Testing related posts
- What am I missing about interfaces?
- Optimizing C# code analysis for quicker .NET compilation
- Integration testing in Umbraco 10+: Validating document types
- Comprehensive Unit Testing: A Line-by-Line Approach
- Integration Tests with In Memory DB vs Real DB on Docker
- Can I set a policy (using `editorconfig`?) to require certain namespace aliases?
- The Moq-gate: You Either Die a Hero...
-
A note from our sponsor - #<SponsorshipServiceOld:0x00007f0f9babc640>
www.saashub.com | 30 Nov 2023
Index
What are some of the best open-source Testing projects in C#? This list will help you:
Project | Stars | |
---|---|---|
1 | Bogus | 7,820 |
2 | xUnit | 3,883 |
3 | Fluent Assertions | 3,463 |
4 | testcontainers-dotnet | 3,251 |
5 | AutoFixture | 3,147 |
6 | NSubstitute | 2,431 |
7 | NUnit | 2,364 |
8 | ReportGenerator | 2,323 |
9 | Verify | 2,179 |
10 | SpecFlow | 2,156 |
11 | Shouldly | 1,942 |
12 | FlaUI | 1,900 |
13 | Stryker.NET | 1,643 |
14 | FakeItEasy | 1,549 |
15 | mockhttp | 1,453 |
16 | System.IO.Abstractions | 1,401 |
17 | coyote | 1,380 |
18 | WireMock.Net | 1,200 |
19 | NetArchTest | 1,108 |
20 | pose | 1,050 |
21 | Compare-Net-Objects | 966 |
22 | Machine.Specifications | 875 |
23 | vstest | 825 |