x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: https://docs.unrealengine.com/latest/INT/Programming/Automation/TechnicalGuide/index.html which (of course) is not up to date and does not give a lot of information. Any feedback appreciated :)

Cheers Pascal

Product Version: UE 4.12
Tags:
more ▼

asked Sep 01 '16 at 08:16 AM in C++ Programming

avatar image

meiwen
146 7 12 18

avatar image CleanCut Sep 01 '16 at 04:24 PM

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

avatar image GenuiTx Apr 04 '17 at 01:18 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Dec 13 '17 at 11:52 PM

avatar image

Squareys
106 2 7 8

avatar image illYay 6 days ago

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question