aikeymouse/test-automation-framework

A unified test automation framework supporting Web, Mobile, and Windows Desktop applications using .NET 8.0 and AI-powered code generation tool.

C#

0

53 commits

updated Jan 18, 2026

See the code

README

AIKeyMouse Automation Framework

A unified test automation framework supporting Web, Mobile, and Windows Desktop applications using .NET 8.0.

Installation

This package is available via GitHub Packages. For installation instructions, see CONSUMING_PACKAGE.md.

Quick install (after configuring GitHub Packages):

dotnet add package AIKeyMouse.Automation.Framework

Features

  • 🌐 Web Automation - Selenium WebDriver with EdgeDriver support for WebView2
  • πŸ“± Mobile Automation - Appium for iOS and Android testing
  • πŸ–₯️ Windows Desktop Automation - FlaUI for Windows UI Automation
  • πŸ”„ Unified API - Common ElementLocator pattern across all platforms
  • πŸ§ͺ BDD Support - Reqnroll (SpecFlow successor) integration
  • 🎯 Page Object Model - Built-in base classes for clean test architecture

Project Structure

AIKeyMouse.Automation.Framework/
β”œβ”€β”€ DataObjects/          # Data models and locator definitions
β”‚   β”œβ”€β”€ ElementLocator.cs            # Unified locator for all platforms
β”‚   β”œβ”€β”€ Locator.cs                   # Locator strategy enum
β”‚   β”œβ”€β”€ EnumValueAttribute.cs        # Attribute for enum values
β”‚   β”œβ”€β”€ MobileDeviceSettings.cs      # Mobile device configuration
β”‚   β”œβ”€β”€ MobileDeviceType.cs          # Mobile device type enum
β”‚   └── NetworkConditionsData.cs     # Network simulation data
β”œβ”€β”€ Extensions/           # Extension methods for all platforms
β”‚   β”œβ”€β”€ LocatorExtension.cs          # Selenium/Appium locator conversion
β”‚   β”œβ”€β”€ LocatorExtension.FlaUI.cs    # FlaUI locator conversion
β”‚   β”œβ”€β”€ SearchContextExtension.cs    # Web/Mobile element finding with waits
β”‚   β”œβ”€β”€ SearchContextExtension.FlaUI.cs # Windows element finding with waits
β”‚   β”œβ”€β”€ WindowExtension.cs           # FlaUI Window helpers
β”‚   β”œβ”€β”€ DriverContextExtension.cs    # Driver context helpers
β”‚   └── TestContextExtension.cs      # Test context helpers
β”œβ”€β”€ Infrastructure/       # Core framework classes
β”‚   β”œβ”€β”€ DriverContext.cs             # Base driver management
β”‚   β”œβ”€β”€ DriverContextWeb.cs          # Web/WebView2 driver management
β”‚   β”œβ”€β”€ DriverContextWindows.cs      # Windows app driver management
β”‚   β”œβ”€β”€ DriverContextProperties.cs   # Driver context properties
β”‚   β”œβ”€β”€ PageBase.cs                  # Base class for page objects
β”‚   β”œβ”€β”€ StepsBase.cs                 # Base class for step definitions
β”‚   β”œβ”€β”€ ConfiguredSettings.cs        # Framework configuration
β”‚   └── DriverOptionsSetEventArgs.cs # Event args for driver options
β”œβ”€β”€ Helpers/             # Helper utilities
β”‚   └── DevToolsHelper.cs            # Chrome DevTools Protocol helpers
└── StepDefinitions/     # Reqnroll step definitions
    └── DevToolsSteps.cs             # DevTools-related steps

Supported Technologies

NuGet Packages

  • Reqnroll 3.3.1 - BDD framework
  • Reqnroll.MSTest 3.3.1 - MSTest integration for Reqnroll
  • Reqnroll.Tools.MsBuild.Generation 3.3.1 - Build-time code generation
  • Selenium.WebDriver 4.39.0 - Web automation
  • Appium.WebDriver 8.0.1 - Mobile automation
  • FlaUI.Core 5.0.0 & FlaUI.UIA3 5.0.0 - Windows UI automation
  • Selenium.WebDriver.MSEdgeDriver 141.0.3537.71 - EdgeDriver for WebView2
  • MSTest.TestFramework 4.0.2 - Testing framework
  • WebDriverManager 2.17.6 - Browser driver management
  • BrowserStackLocal 3.0.0 - BrowserStack tunnel support

Target Framework

  • .NET 8.0 (LTS)

Quick Start

Web/Mobile Automation Example

using AIKeyMouse.Automation.Framework.Infrastructure;
using AIKeyMouse.Automation.Framework.DataObjects;
using AIKeyMouse.Automation.Framework.Extensions;

public class LoginPage : PageBase
{
    private ElementLocator UsernameField => new(Locator.Id, "username");
    private ElementLocator PasswordField => new(Locator.Id, "password");
    private ElementLocator LoginButton => new(Locator.XPath, "//button[@type='submit']");

    public void Login(string username, string password)
    {
        WebDriver.GetElement(UsernameField).SendKeys(username);
        WebDriver.GetElement(PasswordField).SendKeys(password);
        WebDriver.GetElement(LoginButton).Click();
    }
}

Windows Desktop Automation Example

using AIKeyMouse.Automation.Framework.Infrastructure;
using AIKeyMouse.Automation.Framework.DataObjects;
using AIKeyMouse.Automation.Framework.Extensions;

public class CalculatorPage : PageBase
{
    private ElementLocator Button7 => new(Locator.Id, "num7Button");
    private ElementLocator ButtonPlus => new(Locator.Id, "plusButton");
    
    public void Add7Plus5()
    {
        Window.GetButton(Button7)?.Click();
        Window.GetButton(ButtonPlus)?.Click();
        // ...
    }
}

Key Concepts

ElementLocator Pattern

Unified element locator across all platforms:

// Works for Web, Mobile, and Windows
var element = new ElementLocator(Locator.Id, "myElement");
var element2 = new ElementLocator(Locator.XPath, "//div[@class='test']");
var element3 = new ElementLocator(Locator.Name, "Submit");

Supported Locator Types

Locator TypeWeb/MobileWindows (FlaUI)
Idβœ…βœ… (AutomationId)
Nameβœ…βœ…
ClassNameβœ…βœ…
XPathβœ…βœ…
TagNameβœ…βœ… (ControlType)
CssSelectorβœ…βŒ
LinkTextβœ…βŒ
PartialLinkTextβœ…βŒ
AccessibilityIdβœ… (Mobile)❌

Automatic Waits

All element finding operations include built-in wait logic:

// Web/Mobile - uses WebDriverWait with configured timeout
var element = searchContext.GetElement(locator); // Default timeout
var element = searchContext.GetElement(locator, TimeSpan.FromSeconds(20)); // Custom timeout

// Windows - uses FlaUI Retry with configured timeout
var element = window.GetElement(locator); // Default timeout
var button = window.GetButton(locator); // Strongly-typed, with wait

DriverContext

Multi-platform driver management:

public class MyTests : StepsBase
{
    public void TestWebApp()
    {
        // Access WebDriver for web/mobile
        Driver.WebDriver.Navigate().GoToUrl("https://example.com");
    }

    public void TestWindowsApp()
    {
        // Access Windows Application
        Driver.StartWindowsApplication(@"C:\Path\To\App.exe");
        var window = Driver.Window;
        window.GetButton(new ElementLocator(Locator.Id, "btn1"))?.Click();
    }
}

Configuration

Configure timeouts and settings in ConfiguredSettings:

public class ConfiguredSettings
{
    public int ShortTimeout { get; set; } = 10; // seconds
    public int MediumTimeout { get; set; } = 30;
    public int LongTimeout { get; set; } = 60;
}

Installation

  1. Clone the repository
  2. Open in Visual Studio or VS Code
  3. Restore NuGet packages: dotnet restore
  4. Build: dotnet build

Requirements

  • .NET 8.0 SDK or later
  • Windows OS (for FlaUI/Windows automation)
  • WebDrivers (managed automatically by WebDriverManager)
  • Appium Server (for mobile testing)

Known Issues

  • FlaUI packages show NU1701 warnings (compatibility warnings) - these are safe to ignore as FlaUI works correctly on .NET 8.0

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

AIKeyMouse Team

aikeymouse/test-automation-framework

A unified test automation framework supporting Web, Mobile, and Windows Desktop applications using .NET 8.0 and AI-powered code generation tool.

C#

0

53 commits

updated Jan 18, 2026

See the code

README

AIKeyMouse Automation Framework

A unified test automation framework supporting Web, Mobile, and Windows Desktop applications using .NET 8.0.

Installation

This package is available via GitHub Packages. For installation instructions, see CONSUMING_PACKAGE.md.

Quick install (after configuring GitHub Packages):

dotnet add package AIKeyMouse.Automation.Framework

Features

  • 🌐 Web Automation - Selenium WebDriver with EdgeDriver support for WebView2
  • πŸ“± Mobile Automation - Appium for iOS and Android testing
  • πŸ–₯️ Windows Desktop Automation - FlaUI for Windows UI Automation
  • πŸ”„ Unified API - Common ElementLocator pattern across all platforms
  • πŸ§ͺ BDD Support - Reqnroll (SpecFlow successor) integration
  • 🎯 Page Object Model - Built-in base classes for clean test architecture

Project Structure

AIKeyMouse.Automation.Framework/
β”œβ”€β”€ DataObjects/          # Data models and locator definitions
β”‚   β”œβ”€β”€ ElementLocator.cs            # Unified locator for all platforms
β”‚   β”œβ”€β”€ Locator.cs                   # Locator strategy enum
β”‚   β”œβ”€β”€ EnumValueAttribute.cs        # Attribute for enum values
β”‚   β”œβ”€β”€ MobileDeviceSettings.cs      # Mobile device configuration
β”‚   β”œβ”€β”€ MobileDeviceType.cs          # Mobile device type enum
β”‚   └── NetworkConditionsData.cs     # Network simulation data
β”œβ”€β”€ Extensions/           # Extension methods for all platforms
β”‚   β”œβ”€β”€ LocatorExtension.cs          # Selenium/Appium locator conversion
β”‚   β”œβ”€β”€ LocatorExtension.FlaUI.cs    # FlaUI locator conversion
β”‚   β”œβ”€β”€ SearchContextExtension.cs    # Web/Mobile element finding with waits
β”‚   β”œβ”€β”€ SearchContextExtension.FlaUI.cs # Windows element finding with waits
β”‚   β”œβ”€β”€ WindowExtension.cs           # FlaUI Window helpers
β”‚   β”œβ”€β”€ DriverContextExtension.cs    # Driver context helpers
β”‚   └── TestContextExtension.cs      # Test context helpers
β”œβ”€β”€ Infrastructure/       # Core framework classes
β”‚   β”œβ”€β”€ DriverContext.cs             # Base driver management
β”‚   β”œβ”€β”€ DriverContextWeb.cs          # Web/WebView2 driver management
β”‚   β”œβ”€β”€ DriverContextWindows.cs      # Windows app driver management
β”‚   β”œβ”€β”€ DriverContextProperties.cs   # Driver context properties
β”‚   β”œβ”€β”€ PageBase.cs                  # Base class for page objects
β”‚   β”œβ”€β”€ StepsBase.cs                 # Base class for step definitions
β”‚   β”œβ”€β”€ ConfiguredSettings.cs        # Framework configuration
β”‚   └── DriverOptionsSetEventArgs.cs # Event args for driver options
β”œβ”€β”€ Helpers/             # Helper utilities
β”‚   └── DevToolsHelper.cs            # Chrome DevTools Protocol helpers
└── StepDefinitions/     # Reqnroll step definitions
    └── DevToolsSteps.cs             # DevTools-related steps

Supported Technologies

NuGet Packages

  • Reqnroll 3.3.1 - BDD framework
  • Reqnroll.MSTest 3.3.1 - MSTest integration for Reqnroll
  • Reqnroll.Tools.MsBuild.Generation 3.3.1 - Build-time code generation
  • Selenium.WebDriver 4.39.0 - Web automation
  • Appium.WebDriver 8.0.1 - Mobile automation
  • FlaUI.Core 5.0.0 & FlaUI.UIA3 5.0.0 - Windows UI automation
  • Selenium.WebDriver.MSEdgeDriver 141.0.3537.71 - EdgeDriver for WebView2
  • MSTest.TestFramework 4.0.2 - Testing framework
  • WebDriverManager 2.17.6 - Browser driver management
  • BrowserStackLocal 3.0.0 - BrowserStack tunnel support

Target Framework

  • .NET 8.0 (LTS)

Quick Start

Web/Mobile Automation Example

using AIKeyMouse.Automation.Framework.Infrastructure;
using AIKeyMouse.Automation.Framework.DataObjects;
using AIKeyMouse.Automation.Framework.Extensions;

public class LoginPage : PageBase
{
    private ElementLocator UsernameField => new(Locator.Id, "username");
    private ElementLocator PasswordField => new(Locator.Id, "password");
    private ElementLocator LoginButton => new(Locator.XPath, "//button[@type='submit']");

    public void Login(string username, string password)
    {
        WebDriver.GetElement(UsernameField).SendKeys(username);
        WebDriver.GetElement(PasswordField).SendKeys(password);
        WebDriver.GetElement(LoginButton).Click();
    }
}

Windows Desktop Automation Example

using AIKeyMouse.Automation.Framework.Infrastructure;
using AIKeyMouse.Automation.Framework.DataObjects;
using AIKeyMouse.Automation.Framework.Extensions;

public class CalculatorPage : PageBase
{
    private ElementLocator Button7 => new(Locator.Id, "num7Button");
    private ElementLocator ButtonPlus => new(Locator.Id, "plusButton");
    
    public void Add7Plus5()
    {
        Window.GetButton(Button7)?.Click();
        Window.GetButton(ButtonPlus)?.Click();
        // ...
    }
}

Key Concepts

ElementLocator Pattern

Unified element locator across all platforms:

// Works for Web, Mobile, and Windows
var element = new ElementLocator(Locator.Id, "myElement");
var element2 = new ElementLocator(Locator.XPath, "//div[@class='test']");
var element3 = new ElementLocator(Locator.Name, "Submit");

Supported Locator Types

Locator TypeWeb/MobileWindows (FlaUI)
Idβœ…βœ… (AutomationId)
Nameβœ…βœ…
ClassNameβœ…βœ…
XPathβœ…βœ…
TagNameβœ…βœ… (ControlType)
CssSelectorβœ…βŒ
LinkTextβœ…βŒ
PartialLinkTextβœ…βŒ
AccessibilityIdβœ… (Mobile)❌

Automatic Waits

All element finding operations include built-in wait logic:

// Web/Mobile - uses WebDriverWait with configured timeout
var element = searchContext.GetElement(locator); // Default timeout
var element = searchContext.GetElement(locator, TimeSpan.FromSeconds(20)); // Custom timeout

// Windows - uses FlaUI Retry with configured timeout
var element = window.GetElement(locator); // Default timeout
var button = window.GetButton(locator); // Strongly-typed, with wait

DriverContext

Multi-platform driver management:

public class MyTests : StepsBase
{
    public void TestWebApp()
    {
        // Access WebDriver for web/mobile
        Driver.WebDriver.Navigate().GoToUrl("https://example.com");
    }

    public void TestWindowsApp()
    {
        // Access Windows Application
        Driver.StartWindowsApplication(@"C:\Path\To\App.exe");
        var window = Driver.Window;
        window.GetButton(new ElementLocator(Locator.Id, "btn1"))?.Click();
    }
}

Configuration

Configure timeouts and settings in ConfiguredSettings:

public class ConfiguredSettings
{
    public int ShortTimeout { get; set; } = 10; // seconds
    public int MediumTimeout { get; set; } = 30;
    public int LongTimeout { get; set; } = 60;
}

Installation

  1. Clone the repository
  2. Open in Visual Studio or VS Code
  3. Restore NuGet packages: dotnet restore
  4. Build: dotnet build

Requirements

  • .NET 8.0 SDK or later
  • Windows OS (for FlaUI/Windows automation)
  • WebDrivers (managed automatically by WebDriverManager)
  • Appium Server (for mobile testing)

Known Issues

  • FlaUI packages show NU1701 warnings (compatibility warnings) - these are safe to ignore as FlaUI works correctly on .NET 8.0

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

AIKeyMouse Team