Back to Devexpress

Integrate EasyTest into XAF Blazor UI Applications

expressappframework-403393-debugging-testing-and-error-handling-functional-tests-easy-test-write-tests-human-readable-test-blazor-apps.md

latest6.5 KB
Original Source

Integrate EasyTest into XAF Blazor UI Applications

  • Feb 21, 2026
  • 4 minutes to read

Overview

XAF can run functional tests for Blazor UI applications based on the Selenium driver to interact with a browser.

EasyTest for Blazor supports the following browsers:

  • Google Chrome
  • Microsoft Edge

This topic describes how to integrate EasyTest functional testing into your XAF Blazor application.

Prerequisites

Configure your working machine as described below:

  1. Install browser drivers.

  2. Install the DevExpress.ExpressApp.EasyTest.BlazorAdapter package to your YourApplicationName.Blazor.Server project.

Tip

The Template Kit creates new applications that already have integrated EasyTest components. The wizard does the following:

  • Adds the EasyTest solution configuration.

  • Adds all the necessary code to allow you run tests in the EasyTest solution configuration.

  • Adds the FunctionalTests folder with a configuration file (config.xml) and a sample test (sample.ets) to the platform-independent YourApplicationName.Module module. Installs the DevExpress.ExpressApp.EasyTest.BlazorAdapter package to your YourApplicationName.Blazor.Server project (only for the EasyTest solution configuration).

Configuration

The code below demonstrates a sample configuration file. You can edit it according to your project environment.

xml
<?xml version="1.0" encoding="utf-8" ?> 
<Options xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <Applications> 
        <!-- Blazor --> 
        <Application 
            Name="DXApplication1Blazor" 
            Url="http://localhost:4030" 
            PhysicalPath="[BlazorAppPath]" 
            AdapterFileName="[BlazorAdapterAssemblyPath]" 
            Configuration="EasyTest" 
            IgnoreCase="true"/> 
    </Applications> 

    <TestDatabases> 
            <Database xsi:type="TestMSSQLDatabase" Server="(localdb)\mssqllocaldb" DBName="DXApplication1EasyTest"/> 
    </TestDatabases> 

    <Aliases> 
        <Alias Name="BlazorAppPath" Value="[ConfigPath]\..\..\DXApplication1.Blazor.Server" /> 
        <Alias Name="BlazorAdapterAssemblyPath" Value="[BlazorAppPath]\bin\EasyTest\net8.0\DevExpress.ExpressApp.EasyTest.BlazorAdapter.v21.2.dll" /> 
    </Aliases> 
</Options>

Configuration Options

AttributeDescription
NameSpecifies the name of the Application element. This name is used to differentiate between different applications. The Application command takes this name as the parameter.
UrlThe application’s web address.
PhysicalPathA path to the folder that contains the application. You can use the built-in [ConfigPath] alias to specify a path to the Config.xml file.
AdapterFileNameSpecifies a path to the Blazor EasyTest adapter. This is an EasyTest assembly that contains platform-specific functionality. The attribute contains the adapter’s assembly filename, assembly version, culture, and public key.
IgnoreCaseSpecifies whether the test ignores a letter case when referring to UI element names, captions, or tags.
ConfigurationSpecifies the configuration to use when running tests.
WebDriverPathSpecifies a path to a folder that stores a web driver executable.
BrowserSpecifies a web browser to use for running tests. Available values: Chrome, Edge (the default value).

Aliases

AliasDescription
BlazorAppPathA path to a Blazor application.
BlazorAdapterAssemblyPathA path to the Blazor EasyTest adapter. This path typically points to a project’s build results. Reference the DevExpress.ExpressApp.EasyTest.BlazorAdapter adapter and it becomes available in the project’s build results. In new applications created by the Template Kit, the adapter is already referenced in the project and this option is set to a folder with the build results.

Run EasyTest in the Debug Configuration

The following steps describe the modifications required to support EasyTest in the Debug solution configuration.

Note that after updating the solution in this way, EasyTest will use the database connection strings specified in the application projects’ configuration files. As such, you may want to back up the databases used by the applications before running any tests.

In a Blazor application project, update the DatabaseVersionMismatch method in BlazorApplication.cs:

csharp
private void MyBlazorApplication_DatabaseVersionMismatch(object sender, DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs e) { 
#if DEBUG 
    e.Updater.Update(); 
    e.Handled = true; 
#else 
    if (System.Diagnostics.Debugger.IsAttached) { 
        //... 
    } 
    else { 
        //... 
    } 
#endif 
}

Run Tests

Use the TestExecutor Utility to run tests.

console
cd %ProgramFiles%\DevExpress 25.2\Components\Tools\eXpressAppFrameworkNetCore\EasyTest

TestExecutor.v25.2.exe C:\PathToTest\sample.ets

Remove EasyTest

You can remove all EasyTest components from your application. In this case, delete the following:

  • The FunctionalTests folder.
  • The DevExpress.ExpressApp.EasyTest.BlazorAdapter package from Blazor applications.
  • The EASYTEST conditions from the Blazor application project’s BlazorApplication.cs file.

Next Steps