Back to Devexpress

Integrate EasyTest into XAF WinForms Applications

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

latest5.4 KB
Original Source

Integrate EasyTest into XAF WinForms Applications

  • Feb 21, 2026
  • 3 minutes to read

Overview

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

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 necessary code to allow you to 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.

If your application already has EasyTest integrated, go to the Next Steps section.

Configuration

Typically, the EasyTest configuration file (config.xml) is stored in the FunctionalTests folder in a platform-agnostic module (MySolution.Module).

Requirement: Install the DevExpress.ExpressApp.EasyTest.WinAdapter NuGet package to your YourApplicationName.Win project.

The following code snippet 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>
        <!-- Win -->
        <Application
            Name="MySolutionWin"
            FileName="[WinAppBin]\MySolution.Win.exe"
            AdapterFileName="[WinAdapterFileName]"
            CommunicationPort="4100"/>
    </Applications>
    <TestDatabases>
        <Database xsi:type="TestMSSQLDatabase" Server="(localdb)\mssqllocaldb" DBName="MySolutionEasyTest"/>
    </TestDatabases>

    <Aliases>
        <Alias Name="WinAppBin" Value="[ConfigPath]\..\MySolutionWin.Win\Bin\EasyTest" />
        <Alias Name="WinAdapterFileName" Value="[WinAppBin]\DevExpress.ExpressApp.EasyTest.WinAdapter.v25.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.
FileNameSpecifies the fully qualified name of the application’s executable file. You can use the built-in [ConfigPath] alias to specify a path relative to the Config.xml file location.
ArgumentsOptional. Specifies the command-line arguments passed to the application when it is started.
AdapterFileName(For .NET 8+ projects) The path to the WinForms EasyTest adapter. To use the standard adapter, specify the following path: %ProgramW6432%\DevExpress 25.2\Components\Bin\NetCore\DevExpress.ExpressApp.EasyTest.WinAdapter.v25.2.dll
CommunicationPortSpecifies the communication port number that will be used by EasyTest when testing the application.

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 Windows Forms application project, the following methods must be updated:

  1. The DatabaseVersionMismatch method in the WinApplication.cs (WinApplication.vb) file.

  2. The Main method in the Program.cs (Program.vb) file.

  3. In the App.config file, add the following keys to <appSettings> :

  4. EasyTest listens to the default 4100 port. To use another port, specify the EasyTestCommunicationPort key value in the application configuration file (App.config). The custom port must match the port specified in the EasyTest Config.xml configuration file.

Remove EasyTest

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

  • The FunctionalTests folder.
  • The DevExpress.ExpressApp.EasyTest.WinAdapter assembly reference (or NuGet package) from the Windows Forms application project.
  • The EASYTEST conditions from the Windows Forms application project’s Program.cs (Program.vb) and WinApplication.cs (WinApplication.vb) files.

Next Steps