Verisoft.TestInfrastructure 1.0.0

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Verisoft.TestInfrastructure" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Verisoft.TestInfrastructure" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Verisoft.TestInfrastructure" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Verisoft.TestInfrastructure --version 1.0.0
                    
#r "nuget: Verisoft.TestInfrastructure, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Verisoft.TestInfrastructure@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Verisoft.TestInfrastructure&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Verisoft.TestInfrastructure&version=1.0.0
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 109 4/13/2026
1.0.0 592 12/1/2025

Initial release with NUnit lifecycle hooks and Appium integration