Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pruggitorg/unit-test-frameworks-comparison
This project compares MS Test, NUnit, XUnit and Fluent frameworks. Using an example application, various test scenarios are run through and their implementation in the frameworks is shown.
https://github.com/pruggitorg/unit-test-frameworks-comparison
csharp fluent-assertions mstest nunit unit-testing xunit
Last synced: 14 days ago
JSON representation
This project compares MS Test, NUnit, XUnit and Fluent frameworks. Using an example application, various test scenarios are run through and their implementation in the frameworks is shown.
- Host: GitHub
- URL: https://github.com/pruggitorg/unit-test-frameworks-comparison
- Owner: pruggitorg
- License: mit
- Created: 2020-07-22T19:20:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-17T17:41:41.000Z (over 1 year ago)
- Last Synced: 2024-12-05T08:10:32.562Z (2 months ago)
- Topics: csharp, fluent-assertions, mstest, nunit, unit-testing, xunit
- Language: C#
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Comparing Unit Testing Frameworks with Examples of Use
This project compares MS Test, NUnit, XUnit and Fluent frameworks. Using an example application, various test scenarios are run through and their implementation in the frameworks is shown.# At a Glance
## Comparison of basic Assert statements
## Checking with unit tests, if events are fired
## Ensure exceptions are thrown
## Ignoring tests (with attributes and programmatically by extending each unit test framework```csharp
[TestFixture]
public class IgnoreTests
{
[Test, Ignore("This test is ignored on purpose")]
public void IgnoreThisTest()
{
// you will see this test reported as "skipped" in the test run results
}[Test]
public void IgnoreThisTestWithInconclusive()
{
// you will see this test reported as "not run" in the test run results
Assert.Inconclusive("This test will not run.");
}[Test, IgnoreOn64BitPlatform]
public void IgnoreWithCustromAttribute()
{
// ignored with custom attribute
}
}///
/// NUnit 3 implements a great deal of its functionality in its Custom Attributes. This functionality is
/// accessed through a number of standard interfaces, which are implemented by the attributes.
/// Users may create their own attributes by implementing these interfaces.
///
/// Note: Action Attributes are a feature of NUnit V2, designed to better enable composability of test logic.
/// They are carried over to NUnit 3, but are not the recommended approach for most new work.
public sealed class IgnoreOn64BitPlatform : NUnitAttribute, IApplyToTest
{
public void ApplyToTest(Test test)
{
if (Environment.Is64BitOperatingSystem)
test.RunState = RunState.Ignored;
}
}
```