Verisoft.TestInfrastructure
1.0.0
See the version list below for details.
dotnet add package Verisoft.TestInfrastructure --version 1.0.0
NuGet\Install-Package Verisoft.TestInfrastructure -Version 1.0.0
<PackageReference Include="Verisoft.TestInfrastructure" Version="1.0.0" />
<PackageVersion Include="Verisoft.TestInfrastructure" Version="1.0.0" />
<PackageReference Include="Verisoft.TestInfrastructure" />
paket add Verisoft.TestInfrastructure --version 1.0.0
#r "nuget: Verisoft.TestInfrastructure, 1.0.0"
#:package Verisoft.TestInfrastructure@1.0.0
#addin nuget:?package=Verisoft.TestInfrastructure&version=1.0.0
#tool nuget:?package=Verisoft.TestInfrastructure&version=1.0.0
Verisoft.TestInfrastructure
A comprehensive .NET 8 test automation infrastructure NuGet package providing NUnit lifecycle hooks, Appium WebDriver integration, and automated test setup for C# automation projects.
Features
- ✅ Pre-configured NUnit Testing Framework - All necessary NUnit packages included
- ✅ Automatic Lifecycle Logging - Built-in hooks that log before/after each test and test run
- ✅ Appium WebDriver Integration - Appium WebDriver dependency included for mobile automation
- ✅ Code Coverage Support - Includes coverlet collector for code coverage analysis
- ✅ .NET 8 Support - Built on the latest .NET 8 framework
Installation
Install the package from NuGet:
dotnet add package Verisoft.TestInfrastructure
Or via Package Manager Console:
Install-Package Verisoft.TestInfrastructure
Quick Start
1. Create a Test Class
Inherit from VerisoftBaseTest to automatically get lifecycle logging:
using NUnit.Framework;
using Verisoft.TestInfrastructure.Lifecycle;
namespace MyTests;
[TestFixture]
public class SampleTests : VerisoftBaseTest
{
[Test]
public void MyFirstTest()
{
Assert.Pass("Test executed successfully!");
}
[Test]
public void AnotherTest()
{
var result = 2 + 2;
Assert.AreEqual(4, result);
}
}
2. Run Your Tests
dotnet test
You'll see lifecycle messages in your test output:
[2025-12-01 10:30:00.123] === BEFORE EXECUTION (Assembly-level setup) ===
[2025-12-01 10:30:00.456] >>> BEFORE TEST: MyFirstTest
[2025-12-01 10:30:00.789] <<< AFTER TEST: MyFirstTest (Status: Passed)
[2025-12-01 10:30:01.012] >>> BEFORE TEST: AnotherTest
[2025-12-01 10:30:01.234] <<< AFTER TEST: AnotherTest (Status: Passed)
[2025-12-01 10:30:01.567] === AFTER EXECUTION (Assembly-level teardown) ===
Lifecycle Hooks
The package provides two levels of lifecycle management:
Assembly-Level Hooks (Per Test Run)
Automatically executed by the AssemblyLifecycle class:
- Before Execution: Runs once before any test in the assembly
- After Execution: Runs once after all tests complete
Test-Level Hooks (Per Test)
Available when inheriting from VerisoftBaseTest:
- BeforeEachTest: Runs before each
[Test]method - AfterEachTest: Runs after each
[Test]method
You can override these methods to add custom behavior:
public class MyTests : VerisoftBaseTest
{
public override void BeforeEachTest()
{
base.BeforeEachTest(); // Keep the logging
// Your custom setup code here
}
public override void AfterEachTest()
{
// Your custom cleanup code here
base.AfterEachTest(); // Keep the logging
}
}
Appium Integration
The package includes the Appium WebDriver dependency, allowing you to create drivers directly:
Android Example
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.Enums;
public class AndroidTests : VerisoftBaseTest
{
private AndroidDriver? _driver;
[SetUp]
public void SetupDriver()
{
var options = new AppiumOptions();
options.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "Android");
options.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, "emulator-5554");
options.AddAdditionalAppiumOption(MobileCapabilityType.App, "/path/to/app.apk");
options.AddAdditionalAppiumOption("appium:automationName", "UiAutomator2");
_driver = new AndroidDriver(new Uri("http://localhost:4723"), options);
}
[TearDown]
public void CleanupDriver()
{
_driver?.Quit();
}
[Test]
public void TestAndroidApp()
{
// Your test code here
Assert.IsNotNull(_driver);
}
}
iOS Example
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.iOS;
using OpenQA.Selenium.Appium.Enums;
public class IOSTests : VerisoftBaseTest
{
private IOSDriver? _driver;
[SetUp]
public void SetupDriver()
{
var options = new AppiumOptions();
options.AddAdditionalAppiumOption(MobileCapabilityType.PlatformName, "iOS");
options.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, "iPhone 14");
options.AddAdditionalAppiumOption(MobileCapabilityType.App, "/path/to/app.app");
options.AddAdditionalAppiumOption("appium:automationName", "XCUITest");
_driver = new IOSDriver(new Uri("http://localhost:4723"), options);
}
[TearDown]
public void CleanupDriver()
{
_driver?.Quit();
}
[Test]
public void TestIOSApp()
{
// Your test code here
Assert.IsNotNull(_driver);
}
}
Included Dependencies
This package includes and configures the following dependencies:
- Microsoft.NET.Test.Sdk (17.11.1) - Test platform
- NUnit (4.1.0) - Testing framework
- NUnit3TestAdapter (4.6.0) - Test adapter for Visual Studio
- NUnit.Analyzers (4.2.0) - Code analyzers for better test quality
- coverlet.collector (6.0.2) - Code coverage collector
- Appium.WebDriver (8.0.1) - Mobile automation framework
Building and Packing
To build the NuGet package locally:
dotnet pack Verisoft.TestInfrastructure/Verisoft.TestInfrastructure.csproj --configuration Release
The package will be created in Verisoft.TestInfrastructure/bin/Release/.
Contributing
This is Verisoft's internal test infrastructure project. For questions or issues, please contact the Verisoft development team.
License
MIT License - See LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- Appium.WebDriver (>= 8.0.1)
- Microsoft.NET.Test.Sdk (>= 17.11.1)
- NUnit (>= 4.1.0)
- NUnit3TestAdapter (>= 4.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release with NUnit lifecycle hooks and Appium integration