skip to Main Content

Creating Functional Tests with the Automation System

In this post I’m going to show you how to create Functional Tests with the Automation System that comes with the latest version of Unreal Engine 4. With functional tests, we can simulate a user’s behavior (to some extent) and verify that everything is working properly.

In this post we’re going to create a simple script that tests if the player can move X units forward to a level. Once you become familiar with the process you will be able to extend the testing functionality to interactions or more complex systems of your game.

Implementing a functional test

Fortunately, Unreal provides a straightforward to jump start our functional tests. For this post, I’m using a C++ Third Person Template project. To create a functional test, add a new C++ class that inherits the FunctionalTest class. In your header file, add the following code:

On the source file, add the following code:

Compile your code and navigate to your Editor and locate your C++ class. If the C++ Classes folder isn’t visible, make sure to Activate the Show C++ filter from the editor

(Click on image to enlarge)

Once you locate your C++ class, just drag and drop it into your level:

(Click on image to enlarge)

At this point, open up the Session FrontEnd window and notice that in the Automation Tab a new test was added under the Project Category:

(Click on image to enlarge)

In order to run your test you can either:

  • Enable its checkbox and press the Start Tests or
  • Press the Run Level Test. The editor has already marked this level as a test once you placed a functional test in the world
Functional Test

And this is how you can create a simple functional test for your game! Thanks for reading and have a nice day!

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top