Skip to main content
All docs

End-to-End Tests with xUnit

  • 3 minutes to read

You can use the xUnit framework to create and run functional tests for XAF applications.

Step 1—Add the Selenium Driver to Your System


You can skip this step if you test only WinForms XAF applications.

XAF exposes the API that allows you to use the Selenium driver to interact with browser and individual web page elements.

To run functional tests for ASP.NET Web Forms and ASP.NET Core Blazor XAF Applications, install browser drivers.

Selenium requires a path to the downloaded driver. Add a folder with the driver to the system’s PATH variable.

Step 2—Add a Test Project

Right click the solution and select Add DevExpress Item | New Project…. In the DevExpress Template gallery, select .NET Core, XAF Solution Wizard (.NET Core) and click Run Wizard.

easytest add test project template gallery

The XAF Solution Wizard opens. Select End-to-End Testing Project, specify the project name and click Finish.

easytest add test project

Add a test project manually

Add a new “xUnit Test Project” project to your solution.

In the project file, change the following:

  <!-- Set a target framework for Blazor -->

  <!-- Set a target framework for .NET6+ Desktop (and Blazor)  -->

Add EasyTest references.

    <!-- .NET 6+ WinForms-->
    <Reference Include="DevExpress.EasyTest.v22.1">
    <Reference Include="DevExpress.ExpressApp.EasyTest.WinAdapter.v22.1">
    <Reference Include="DevExpress.ExpressApp.EasyTest.BlazorAdapter.v22.1">


Configure end-to-end tests.

public class MainDemoFixture : BaseFixture {
    protected const string BlazorAppName = "MainDemoBlazor";
    protected const string OnlineBlazorDemo = "OnlineBlazorDemo";
    protected const string WinAppName = "MainDemoWin";
    protected const string MainDemoDBName = "MainDemo";
    public MainDemoFixture(ITestOutputHelper output) : base(output) {
            new BlazorApplicationOptions(BlazorAppName, @$"{XafPath}\Demos\CS\MainDemo\MainDemo.Blazor.ServerSide"),
            new BlazorApplicationOptions(OnlineBlazorDemo, string.Empty, url: @""),
            new WinApplicationOptions(WinAppName, @$"{XafPath}\Demos\CS\MainDemo\MainDemo.Win\bin\EasyTest\MainDemo.Win.exe")
        FixtureContext.RegisterDataBases(new DataBaseOptions(MainDemoDBName, "MainDemo_v22.1", DataBaseType.MSSQL, server: "(localdb)\\mssqllocaldb"));


The Solution Wizard can create a new solution that already have integrated a functional test project.

easy test create test project

Step 3—Create a Test

Add test code.

public void MainDemo_CreateTask(string applicationName) {
        var appContext = FixtureContext.CreateApplicationContext(applicationName);
        appContext.GetForm().FillForm(("User Name", "Sam"));
        appContext.GetAction("Log In").Execute();
            ("Subject", "Prepare financial statements for presentation to boards of directors"),
            ("Priority", "Normal"),
            ("Start Date", "1/11/2006"),
            ("Due Date", "1/12/2006")
            new string[] { "Prepare financial statements for presentation to boards of directors", "Normal", "1/11/2006", "1/12/2006" },
            appContext.GetForm().GetPropertyValues("Subject", "Priority", "Start Date", "Due Date"));

Run Tests

  1. Switch the solution configuration to EasyTest.
  2. Build the solution.
  3. Right-click the solution and select Run Tests.