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"

How do I create an automation test?

So I've spent my weekend trying to learn about automation tests. I understand that I can create them using one of two macros, but I don't know how to implement something I want to do. I also just have some questions about testing in general.

Say I have an actor called AGrid. I would like to run a simple test where I make an empty map (I think you can do this with FAutomationEditorCommonUtils::CreateNewMap()), spawn an AGrid in that empty map, and check that everything is initialized correctly. I just can't seem to make a version of this test that compiles.

Say I have an actor called ASquareGrid, with a function called AddTile(int x, int y, int z). Do I need to spawn a grid as described in the above paragraph, or is there a way to test the actor without spawning it in a map? Can I just declare ASquareGrid as a variable and call functions on it?

Some code examples would be useful, because I just can't seem to find anything online. I'm also not sure if https://docs.unrealengine.com/en-us/Programming/Automation/TechnicalGuide is up to date.

Some code examples would be useful, because I just can't seem to find anything online.

Product Version: UE 4.19
Tags:
more ▼

asked May 13 '18 at 10:28 AM in C++ Programming

avatar image

Stormbreath
1 1 2

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

1 answer: sort voted first

Hi Stormbreath!

Glad I'm not the only one using the AutomationTesting :D

not sure if [...] is up to date.

It's not.

Use AutomationLoadMap(MapName); instead of FEngineAutomationTestUtilities::LoadMap(MapName); for example. And adding a test looks more like this:

 IMPLEMENT_SIMPLE_AUTOMATION_TEST(FMyTest, "MyGame.SubElement", EAutomationTestFlags::EditorContext | EAutomationTestFlags::ClientContext | EAutomationTestFlags::ProductFilter)
 bool FGamesTest::RunTest(const FString& Parameters) {
     TestTrue("Some Condition", false, true);
 }

I recommend using the Engine's tests as a base. I've been wanting to write an "up-to-date tutorial" for half a year now. I may find time to do so today and then post a link to it here.

Cheers, Jonathan.

more ▼

answered Aug 12 '18 at 09:18 AM

avatar image

Squareys
101 2 7 7

avatar image LDOGLONDON Apr 19 '19 at 07:58 PM

I hope you do!

avatar image Squareys Apr 19 '19 at 08:59 PM

I actually did, aparently the same day and completely forgot to put the link here, sorry!

https://blog.squareys.de/ue4-automation-testing/

avatar image LDOGLONDON Apr 19 '19 at 09:08 PM

Oh yeah, I was actually using that lol. Thanks, really good tutorial! Would you happen to know the difference between UE4's EditorTests module and RuntimeTests plugins? I'm currently setting up my tests like that, but I'm not sure if the plugins are set up differently or if thats just a clean way of keeping those tests separate.

Again thanks for the tutorial!

avatar image Squareys Apr 19 '19 at 09:17 PM

Awesome! Great to hear you like the tutorial.

I think it's just a way to keep them organized. Especially since Editor tests don't need to be bundled with the Game, i.e. you can deactivate the module for those.

avatar image LDOGLONDON Apr 19 '19 at 09:29 PM

Okay, cool thanks!

(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