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 you write and run C++ tests?

I've had a read of https://docs.unrealengine.com/latest/INT/Programming/Automation/TechnicalGuide/index.html

...and I've found a few things in the forums about it, like https://forums.unrealengine.com/showthread.php?56106-Need-Help-with-Automation-Testing-in-4-6&s=99364033047c10ddb8f3781b137cb2a6

However, I still fail to understand a few basic things about tests for the engine.

1) There are lots of flags for tests in Engine/Source/Runtime/Core/Public/Misc/AutomationTest.h. Which ones are for what?

Specifically, for example, say I have:

  • A set of blue print functions, that I want to test outside the editor what is the appropriate flag? (eg. Foo(a, b) -> A + B; I want to assert the behavior of this function is correct; it has no external dependencies beyond its direct inputs)

  • A component that does various things on update and I want to create an actor that has the component associated with it, and then assert some in-game behaviour for it. What flag is appropriate? (ATF_Game?)

At a technical level, what do these flags actually do?

2) Why does the hot reload not reload tests?

I literally have to restart the editor to get the automation tool to load the new versions of the tests.

I've tried disconnecting from the session, reconnecting, etc. and no luck.

3) Given that you have to restart the editor to rerun tests, how do you invoke them from the command line?

There's some suggestion you can use the RunUAT tool for this, but I can't find what combination of flags to pass it.

I do not want to generate a build of the whole project, and assume that I have already used Build.sh to confirm that the tests compile; I literally just want to run the automation tool and get the results (ideally in a text format that can easily be parsed).

Product Version: Not Selected
Tags:
more ▼

asked Mar 17 '15 at 03:29 AM in C++ Programming

avatar image

shadowmint
537 17 18 80

avatar image burgerbob Oct 18 '15 at 08:11 PM

I would love an answer to this, I have been trying to figure out automation testing for the last day and a half, and my test is currently building, but I can't find it anywhere in the automation tool.

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

2 answers: sort voted first

fwiw if anyone else finds this question, the closest I ever got to an answer was: http://stackoverflow.com/questions/29135227/how-do-you-run-tests-from-the-command-line

Didn't work for me.

Just write your own tests in your own C++ test framework and trigger them yourself manually.

more ▼

answered Mar 27 '15 at 08:06 AM

avatar image

shadowmint
537 17 18 80

avatar image John Vanderbeck Aug 25 '15 at 08:30 PM

Are you just mocking the UE objects?

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

A set of blue print functions, that I want to test outside the editor what is the appropriate flag? (eg. Foo(a, b) -> A + B; [...])

This is a super fast test, so you can add SmokeFilter. Also, you don't require any context, so you can pass the entire ApplicationContextMask rather than specifying this test can be run in a Game context, Editor context etc.

Your final flags parameter would therefore look like this: ApplicationContextMask | SmokeFilter.

The in-code documentation in AutomationTest.h of the flags is actually pretty good for these enum values.

Why does the hot reload not reload tests?

There is a bug open for this: https://issues.unrealengine.com/issue/UE-25350 and marked as "backlogged", so fingers crossed that this will work some day.

Given that you have to restart the editor to rerun tests, how do you invoke them from the command line?

Find the answer to that here: https://answers.unrealengine.com/questions/354798/running-command-line-automation-tests-410.html

more ▼

answered Dec 14 '17 at 02:07 PM

avatar image

Squareys
101 2 7 8

(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