/** * Execute the loading of each map and performance captures * * @param Parameters - Should specify which map name to load * @return TRUE if the test was successful, FALSE otherwise */ bool FLoadAllMapsInGameTest::RunTest(const FString& Parameters) { FString MapName = Parameters; //Open the map GEngine->Exec(GetSimpleEngineAutomationTestGameWorld(GetTestFlags()), *FString::Printf(TEXT("Open %s"), *MapName)); if( FAutomationTestFramework::GetInstance().IsScreenshotAllowed() ) { //Generate the screen shot name and path FString ScreenshotFileName; const FString TestName = FString::Printf(TEXT("LoadAllMaps_Game/%s"), *FPaths::GetBaseFilename(MapName)); AutomationCommon::GetScreenshotPath(TestName, ScreenshotFileName, true); //Give the map some time to load ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.5f)); //Take the screen shot ADD_LATENT_AUTOMATION_COMMAND(FTakeViewportScreenshotCommand(ScreenshotFileName)); //Give the screen shot a chance to capture the scene ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(0.5f)); } //Kick off any Automation matinees that are in this map ADD_LATENT_AUTOMATION_COMMAND(FEnqueuePerformanceCaptureCommands()); return true; }
bool FIOSFriendsTest::RunTest(const FString& Parameters) { ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(3.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("online sub=ios test friends"))); return true; }
bool FMCPAccountDeletionTest::RunTest(const FString& Parameters) { ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(3.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("online sub=mcp test deleteaccount [email protected] Epic3234"))); return true; }
bool FSteamAchievementsTest::RunTest(const FString& Parameters) { ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(3.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("online sub=steam test achievements"))); return true; }
bool FMCPTitleFileTest::RunTest(const FString& Parameters) { ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(3.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("online sub=mcp test titlefile"))); return true; }
bool FFacebookIdentityTest::RunTest(const FString& Parameters) { ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(3.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("online sub=facebook test identity "))); return true; }
bool FHttpTest::RunTest(const FString& Parameters) { ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(3.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("http test 3 \"www.google.com\" "))); return true; }
bool FSteamLeaderBoardTest::RunTest(const FString& Parameters) { ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(3.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("online sub=steam test leaderboards"))); return true; }
/** * Change resolutions, wait, and change back * * @param Parameters - Unused for this test * @return TRUE if the test was successful, FALSE otherwise */ bool FSetResTest::RunTest(const FString& Parameters) { //Gets the default map that the game uses. const UGameMapsSettings* GameMapsSettings = GetDefault<UGameMapsSettings>(); const FString& MapName = GameMapsSettings->GetGameDefaultMap(); //Opens the actual default map in game. GEngine->Exec(GetSimpleEngineAutomationTestGameWorld(GetTestFlags()), *FString::Printf(TEXT("Open %s"), *MapName)); //Gets the current resolution. int32 ResX = GSystemResolution.ResX; int32 ResY = GSystemResolution.ResY; FString RestoreResolutionString = FString::Printf(TEXT("setres %dx%d"), ResX, ResY); //Change the resolution and then restore it. ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(2.0f)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("setres 640x480"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(2.0f)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(RestoreResolutionString)); return true; }
bool FCinematicFPSPerfTest::RunTest(const FString& Parameters) { //Map to use for this test. const FString MapName = Parameters; //The name of the matinee actor that will be triggered. FString MatineeActorName; //Check we are running from commandline const FString CommandLine(FCommandLine::Get()); if (CommandLine.Contains(TEXT("AutomationTests"))) { //Get the name of the matinee to be used. //If the game was not launched with the -MatineeName argument then this test will be ran based on time. if (FParse::Value(*CommandLine, TEXT("MatineeName="), MatineeActorName)) { //Load map ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); ADD_LATENT_AUTOMATION_COMMAND(FLoadGameMapCommand(MapName)); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); //Start the matinee and perform the FPS Chart ADD_LATENT_AUTOMATION_COMMAND(FMatineePerformanceCaptureCommand(MatineeActorName)); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); return true; } else { UE_LOG(LogEngineAutomationTests, Log, TEXT("The matinee name was not specified. Run the game with -MatineeName=\"Name of the matinee actor\".")); //Get the name of the console event to trigger the cinematic FString CinematicEventCommand; if (!FParse::Value(*CommandLine, TEXT("CE="), CinematicEventCommand)) { UE_LOG(LogEngineAutomationTests, Log, TEXT("A console event command was not specified. Defaults to CE START. Run the game with -CE=\"Command\".")); CinematicEventCommand = TEXT("CE Start"); } //Get the length of time the cinematic will run float RunTime; if (!FParse::Value(*CommandLine, TEXT("RunTime="), RunTime)) { UE_LOG(LogEngineAutomationTests, Log, TEXT("A run time length in seconds was not specified. Defaults to 60 seconds. Run the game with -RunTime=###.")); RunTime = 60.f; } //Load map ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); ADD_LATENT_AUTOMATION_COMMAND(FLoadGameMapCommand(MapName)); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); //Start the matinee and perform the FPS Chart ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(CinematicEventCommand)); ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StartFPSChart"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(RunTime)); ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StopFPSChart"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); return true; } } //If the user is running from the UFE then we'll use the default values. //@todo Give the end user a way to specify the values for this test. UE_LOG(LogEngineAutomationTests, Log, TEXT("Running the FPS chart performance capturing for 60 seconds while in '%s'.\nThe default CE command won't be used at this time."), *MapName); //Load map ADD_LATENT_AUTOMATION_COMMAND(FLoadGameMapCommand(MapName)); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); //Start the matinee and perform the FPS Chart ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StartFPSChart"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(60.0f)); ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StopFPSChart"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f)); return true; }
/** * Execute the loading of one map to verify screen captures and performance captures work * * @param Parameters - Unused for this test * @return TRUE if the test was successful, FALSE otherwise */ bool FStatsVerificationMapTest::RunTest(const FString& Parameters) { UAutomationTestSettings const* AutomationTestSettings = GetDefault<UAutomationTestSettings>(); check(AutomationTestSettings); FString MapName = AutomationTestSettings->AutomationTestmap.FilePath; //Get the location of the map being used. FString Filename = FPaths::ConvertRelativePathToFull(MapName); //If the filename doesn't exist then we'll make the filename path relative to the engine instead of the game and the retry. if (!FPaths::FileExists(Filename)) { FString EngDirectory = FPaths::ConvertRelativePathToFull(FPaths::EngineContentDir()); Filename = EngDirectory / MapName; Filename.ReplaceInline(TEXT("/Content/../../"), TEXT("/"),ESearchCase::CaseSensitive); } if (FPaths::FileExists(Filename)) { //If the map is located in the engine folder then we'll make the path relative to that. Otherwise it will be relative to the game content folder. if (Filename.Contains(TEXT("Engine"), ESearchCase::IgnoreCase, ESearchDir::FromStart)) { //This will be false if the map is on a different drive. if (FPaths::MakePathRelativeTo(Filename, *FPaths::EngineContentDir())) { FString ShortName = FPaths::GetBaseFilename(Filename); FString PathName = FPaths::GetPath(Filename); MapName = FString::Printf(TEXT("/Engine/%s/%s.%s"), *PathName, *ShortName, *ShortName); UE_LOG(LogEngineAutomationTests, Log, TEXT("Opening '%s'"), *MapName); GEngine->Exec(GetSimpleEngineAutomationTestGameWorld(GetTestFlags()), *FString::Printf(TEXT("Open %s"), *MapName)); } else { UE_LOG(LogEngineAutomationTests, Error, TEXT("Invalid asset path: %s."), *Filename); } } else { //This will be false if the map is on a different drive. if (FPaths::MakePathRelativeTo(Filename, *FPaths::GameContentDir())) { FString ShortName = FPaths::GetBaseFilename(Filename); FString PathName = FPaths::GetPath(Filename); MapName = FString::Printf(TEXT("/Game/%s/%s.%s"), *PathName, *ShortName, *ShortName); UE_LOG(LogEngineAutomationTests, Log, TEXT("Opening '%s'"), *MapName); GEngine->Exec(GetSimpleEngineAutomationTestGameWorld(GetTestFlags()), *FString::Printf(TEXT("Open %s"), *MapName)); } else { UE_LOG(LogEngineAutomationTests, Error, TEXT("Invalid asset path: %s."), *MapName); } } } else { UE_LOG(LogEngineAutomationTests, Log, TEXT("Automation test map doesn't exist or is not set: %s. \nUsing the currently loaded map."), *Filename); } ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat game"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat game"))); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat scenerendering"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat scenerendering"))); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat memory"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat memory"))); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat slate"))); ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0)); ADD_LATENT_AUTOMATION_COMMAND(FExecStringLatentCommand(TEXT("stat slate"))); return true; }