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"

Writing Automation Tests: Do I need to build engine from source?

I'm trying to write some automation tests to capture perf stats from my game while it is running. The examples I found in EngineAutomationTests.cpp and in the Automation Technical Guide seem to reference private engine code (in particular, classes defined in AutomationTestCommon.h and AutomationTestCommon.cpp).

Does this mean we should be building the UE4 engine in order to write tests? Or copy a bunch of private code into my game?

Product Version: Not Selected
Tags:
more ▼

asked Dec 16 '14 at 06:03 PM in C++ Programming

avatar image

jcoombs
91 5 8 12

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

1 answer: sort voted first

Hello jcoombs,

I've put in a ticket to move the code in the AutomationTestCommons out of private so that you can easily use that code instead of having to copy and paste it. I'll put a note in our ticket to reply back to this thread once a build with it is available.

Normally for performance capture we use a capture FPS command that will capture and dump the several pieces of performance data to a HTML file as well as a csv in the Game/Saved/Profiling folder. Use StartFPSChart and StopFPSChart while in game to start and stop the charting.

For more info: https://docs.unrealengine.com/latest/INT/Engine/Performance/index.html

I believe you can do this using this piece of code. This uses latent commands so that they'll run over more than one frame.

 /**
 * Latent command to run an exec command that also requires a UWorld.
 */
 DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FExecWorldStringLatentCommand, FString, ExecCommand);

 /**
 * Updates the latent command
 */
 bool FExecWorldStringLatentCommand::Update()
 {
     check(GEngine->GetWorldContexts().Num() == 1);
     check(GEngine->GetWorldContexts()[0].WorldType == EWorldType::Game);
 
     UE_LOG(LogEngineAutomationLatentCommand, Log, TEXT("Running Exec Command. '%s'"), *ExecCommand);
     GEngine->Exec(GEngine->GetWorldContexts()[0].World(), *ExecCommand);
     return true;
 }
 
 
 //Add this to your actual test code...
 //Run the Stat FPS Chart command    
    ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StartFPSChart")));
 
 //Wait for a determined amount of time in seconds.
 ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0));
 
 //Run the Stat FPS Chart command        
 ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StopFPSChart")));



Take note that this forum may have changed the whitespacing for that code...

more ▼

answered Dec 17 '14 at 04:05 PM

avatar image jcoombs Jan 06 '15 at 09:27 PM

Thanks, I got things working for now by copying some of test code into my project and use StartFPSChart/StopFPSChart commands as shown above.

(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