fm.Extensions.Testing
8.2.1
dotnet add package fm.Extensions.Testing --version 8.2.1
NuGet\Install-Package fm.Extensions.Testing -Version 8.2.1
<PackageReference Include="fm.Extensions.Testing" Version="8.2.1" />
<PackageVersion Include="fm.Extensions.Testing" Version="8.2.1" />
<PackageReference Include="fm.Extensions.Testing" />
paket add fm.Extensions.Testing --version 8.2.1
#r "nuget: fm.Extensions.Testing, 8.2.1"
#addin nuget:?package=fm.Extensions.Testing&version=8.2.1
#tool nuget:?package=fm.Extensions.Testing&version=8.2.1
fm.Extensions.Testing
- Provides a MSTest base class for tests.
- Extends
TestMethod
with retry capability and graceful failure.
TestsBase
Provides a TestContext
and various helpers to read/write test files.
Example
[TestClass]
public sealed class ExampleTests : TestsBase
{
[TestMethod]
public void ExampleTest()
{
// Your test logic here.
}
}
TestMethodEx
RetryCount
Retries failed tests.
[TestMethodEx(RetryCount = 6), Description("This test will be executed 5 times and succeed.")]
public void RetryUntilPassesTest()
{
int executionCount = this.TestContext.GetProperty<int>("ExecutionCount", 1);
this.TestContext.WriteLine($"Current ExecutionCount: {executionCount:0}");
this.TestContext.SetProperty<int>("ExecutionCount", executionCount + 1);
executionCount.ShouldBe(5);
}
[TestMethodEx(RetryCount = 2), Description("This test will be executed 3 times and fail.")]
public void RetryUntilFailsTest()
{
int executionCount = this.TestContext.GetProperty<int>("ExecutionCount", 1);
this.TestContext.WriteLine($"Current ExecutionCount: {executionCount:0}");
this.TestContext.SetProperty<int>("ExecutionCount", executionCount + 1);
executionCount.ShouldBe(5);
}
RetryDelay
Waits the given amount of time between retries.
[TestMethodEx(RetryCount = 2, RetryDelay = 1_000),
Description("This test will be executed max. 3 times, we will wait 1s in between tries.")]
public void RetryAndWaitTest()
{
// My test...
}
TreatFailedAsInconclusive
If the test fails, it will be treated as Inconclusive.
[TestMethodEx(TreatFailedAsInconclusive = true)]
public void TreatFailedAsInconclusiveTest()
{
Assert.Fail("This test fails, but will be treated as inconclusive.");
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- MSTest.TestFramework (>= 3.8.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on fm.Extensions.Testing:
Package | Downloads |
---|---|
fm.Extensions.Testing.DependencyInjection
Provides a base class for tests based on Microsoft.Extensions.DependencyInjection. Use common Startup.cs patterns like ConfigureConfiguration(...), ConfigureServices(...) and Configure(...) to setup your tests. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
8.2.1 | 184 | 4/22/2025 |
8.2.0 | 104 | 4/19/2025 |
8.1.0 | 105 | 4/19/2025 |
8.0.0 | 144 | 11/15/2024 |
7.0.2 | 153 | 7/19/2024 |
7.0.1 | 180 | 4/5/2024 |
7.0.0 | 145 | 3/27/2024 |
6.2.0 | 289 | 11/5/2023 |
6.1.0 | 236 | 6/20/2023 |
6.0.0 | 312 | 3/4/2023 |
5.6.0 | 487 | 9/27/2022 |
5.5.0 | 522 | 8/5/2022 |
5.4.0 | 807 | 8/12/2021 |
5.2.0 | 576 | 3/16/2021 |
5.0.1 | 1,075 | 1/9/2020 |
5.0.0 | 750 | 9/4/2019 |
4.0.0 | 1,346 | 6/28/2018 |
3.1.1 | 1,418 | 5/7/2018 |
3.1.0 | 1,156 | 1/3/2018 |
3.0.0 | 1,127 | 10/9/2017 |
2.0.0 | 1,655 | 3/2/2017 |
1.1.0 | 1,903 | 6/29/2016 |
1.0.0 | 2,271 | 11/27/2015 |
Migrate the features of 'fm.Extensions.Testing.MSTest' into this project.