Get Started

To run the first test for your Unreal app you need to:

Note

If you don’t have access to the source code of the app, you need to ask a person with access to provide you with a version of the app that includes the AltTester® Plugin.

Download the AltTester® Plugin

To add the AltTester® Unreal SDK to your Unreal application, you first need to download the AltTester® Plugin. You can obtain it by visiting the AltTester® website.

Important

To download the AltTester® Plugin on macOS, you can use the wget command for convenience. Otherwise, if downloading via a browser, ensure to either allow the files from Privacy & Security Settings if macOS prevents the file from being opened or remove the quarantine attribute from the downloaded files.

Please check the Troubleshooting section for more detailed instructions on how to solve this problem.

Set up the AltTester® Unreal SDK in your project

  • Extract the AltTesterUnrealSDK-Package.zip: Unzip the downloaded file and navigate to the Plugin folder.

../_images/unzip-alttester-unreal-sdk-package.png
  • Move the AltTester-Unreal-SDK folder: Place the AltTester-Unreal-SDK folder into the UE_5.x\Engine\Plugins\Marketplace directory (Note: If the Marketplace folder does not exist, create it manually).

  • Open your project in Unreal Engine: Once your project is loaded, go to the top toolbar, click Edit, and then select Plugins from the dropdown menu to open the Plugins browser.

../_images/open-project-plugins-browser.png
  • Enable AltTester®: In the Plugins browser, search for AltTester using the search bar, and check the Enabled box next to the AltTester® icon.

../_images/enable-alttester-plugin.png
  • Restart the editor: A prompt will appear at the bottom of the Plugins window indicating that the editor must be restarted for the changes to occur. Restart the editor to complete the process.

../_images/restart-editor-plugin-changes.png

Note

If changes are made inside a test, rebuilding the application is not necessary. A rebuild is needed only if changes are made inside the Unreal project.

Start the AltTester® Server Module

The AltTester® Server Module is incorporated in AltTester® Desktop. In order to start it, all you have to do is to open AltTester® Desktop.

Compatibility matrix for AltTester® Unreal SDK and AltTester® Desktop

AltTester® Desktop

AltTester® Driver

AltTester® Unreal SDK versions

2.2.x

2.2.x

v.1.0.x

Run your app in Unreal Editor or on desired platform

Before running your tests you need to start the instrumented Unreal application. Upon startup, your instrumented Unreal app should display a popup with the message: “Waiting for connections on port: {Port}”. The popup disappears when your app has successfully connected to the tests.

Write and execute first test for your app

To write tests with AltTester® SDK you need to import the AltDriver in your tests project.

AltTester® package contains AltDriver class used to connect to the instrumented app. In the setup method create an instance of the driver and in the tear-down method invoke the stop method of the driver. With the instance of the driver you can query the Unreal objects and interact with the app.

Prerequisite:
  • .NET installed.

  • Instrumented build.

  • The AltTester® Desktop installed on your PC.

Connection:

The AltTester® Desktop must be running on your PC while the tests are running.

  1. The AltTester® Desktop app is running.

  2. The instrumented build is running.

  3. Configure the IP of the build in order to match the IP of the machine (PC) the Desktop app is running on.

  4. Then press the restart button in the AltTester® dialog and wait until the Connected to AltTester® Server… message is displayed in the dialog.

Test Setup:
  • You can use any IDE you want. As a suggestion, we prefer Visual Studio Code.

  • To be able to run our test scripts, we should use a testing framework. For this tutorial, we will use the NUnit testing framework.

  • In order to use NUnit, you should start by creating an NUnit project. To do this, you need to create an empty folder (this will be the project folder) and open it in Visual Studio Code. Open a terminal (we preferred git bash) and run the command below. This command will create a basic NUnit project for you:

dotnet new nunit
  • To be able to interact with the game through your tests, you need AltDriver. To add the AltDriver to your testing project, all you need to do is to use the following command in your terminal:

dotnet add package AltTester-Driver --version x.y.z

Note that the x.y.z is the version of AltDriver you want to install.

Writing tests:
  • There are many ways in which the project can be organized. We suggest using the Page Object Model design pattern to organize your project into pages folders and tests folders.

  • To initialize the AltDriver in your project, you should import it. You can do it by using the following syntax: using AltTester.AltTesterUnitySDK.Driver;.

  • After that you can initialize the AltDriver: altDriver = new AltDriver();.

Note: At the moment, we use the same AltDriver for both the AltTester Unreal SDK and the AltTester Unity SDK, which is why the namespace includes AltTesterUnitySDK. However, this will be updated in the future to better reflect its usage with the Unreal SDK.

Running the tests:
  • To run your test, open a terminal window in the project folder and paste the following command:

dotnet test

Example test file:

using NUnit.Framework;
using AltTester.AltTesterUnitySDK.Driver;

public class MyFirstTest
{
    private AltDriver altDriver;

    [OneTimeSetUp]
    public void SetUp()
    {
        altDriver = new AltDriver();
    }

    [OneTimeTearDown]
    public void TearDown()
    {
        altDriver.Stop();
    }

    [Test]
    public void TestStartGame()
    {
        altDriver.LoadScene("MainMenu");

        altDriver.FindObject(By.NAME, "Close Button").Click();
        altDriver.FindObject(By.NAME, "Button").Click();

        var panelElement = altDriver.WaitForObject(By.NAME, "Panel");
        Assert.IsTrue(panelElement.enabled);
    }
}

Now your project can use all the AltDriver Commands.

Note

Before the connection step, start the instrumented app and wait for the green popup with the message: Waiting to connect to AltTester® Server on IP:port with app name: ‘your app name’.