Creating Actors in Automation Tests

Hi Folks,

I am currently trying to setup automated tests for our game. I got so far that I my tests show up in editor now and I can run them. What I am trying to achieve now is to spawn a new actor and test if it is initialized correctly. I cant access UWorld from my test. I found that there are the AutomationEditorCommonUtils but I always get the following error using them:

C:\Program Files\Epic Games\4.12\Engine\Source\Runtime\Engine\Public\Tests\AutomationCommon.h(55): error C2065: ‘GEngine’: undeclared identifier

Is there a general tutorial for automated testing? All I can find so far is this:

which (of course) is not up to date and does not give a lot of information.
Any feedback appreciated :slight_smile:


I would also like to get into automated testing, and have found the documentation to be awful at best.

I have similar problem with testing objects like scene components. Whole UEEditor crashes with “FObjectInitializer::Get() can only be used inside of UObject-derived class constructor.” when trying to initialize such in the test.

I use a copy of GetAnyGameWorld() from AutomationCommon.cpp, which always returns the same UWorld* that has been used for loading the map with AutomationOpenMap(TEXT("...")).

You can then proceed to spawn the actor as you would in the game.

1 Like

This works for me, but is quite hacky. I hope they have a better solution soon.

It only works if you’re in a PIE or Game session unless you modified the function. I make my test throw up a warning if the return value was null, telling people to start a PIE or game session to run the test. Fortunately this isn’t a problem for my specific test I’m working on even though it’s quite hacky.