void ConsoleCommandTestComplete(bool bSuccess, FString Test, FAutomationTestExecutionInfo const& Results, FOutputDevice* Ar) { for ( TArray<FString>::TConstIterator ErrorIter( Results.Errors ); ErrorIter; ++ErrorIter ) { Ar->Logf(ELogVerbosity::Error, TEXT("%s"), **ErrorIter); } for ( TArray<FString>::TConstIterator WarningIter( Results.Warnings ); WarningIter; ++WarningIter ) { Ar->Logf(ELogVerbosity::Warning, TEXT("%s"), **WarningIter ); } for ( TArray<FString>::TConstIterator LogItemIter( Results.LogItems ); LogItemIter; ++LogItemIter ) { Ar->Logf(ELogVerbosity::Log, TEXT("%s"), **LogItemIter ); } if (bSuccess) { Ar->Logf(ELogVerbosity::Log, TEXT("...Automation Test Succeeded (%s)"), *Test); } else { Ar->Logf(ELogVerbosity::Error, TEXT("...Automation Test Failed (%s)"), *Test); } bTestInPogress = false; NumTestsRun++; if (!bTicking) { GLog->Logf(ELogVerbosity::Log, TEXT("...Automation Test Queue Empty %d tests performed."), NumTestsRun); NumTestsRun = 0; } }
/** * Helper method to dump the contents of the provided test name to execution info map to the provided feedback context * * @param InContext Context to dump the execution info to * @param InInfoToDump Execution info that should be dumped to the provided feedback context */ void FAutomationTestFramework::DumpAutomationTestExecutionInfo( const TMap<FString, FAutomationTestExecutionInfo>& InInfoToDump ) { const FString SuccessMessage = NSLOCTEXT("UnrealEd", "AutomationTest_Success", "Success").ToString(); const FString FailMessage = NSLOCTEXT("UnrealEd", "AutomationTest_Fail", "Fail").ToString(); for ( TMap<FString, FAutomationTestExecutionInfo>::TConstIterator MapIter(InInfoToDump); MapIter; ++MapIter ) { const FString& CurTestName = MapIter.Key(); const FAutomationTestExecutionInfo& CurExecutionInfo = MapIter.Value(); UE_LOG(LogAutomationTest, Log, TEXT("%s: %s"), *CurTestName, CurExecutionInfo.bSuccessful ? *SuccessMessage : *FailMessage); if ( CurExecutionInfo.Errors.Num() > 0 ) { SET_WARN_COLOR(COLOR_RED); CLEAR_WARN_COLOR(); for ( TArray<FAutomationEvent>::TConstIterator ErrorIter( CurExecutionInfo.Errors ); ErrorIter; ++ErrorIter ) { UE_LOG(LogAutomationTest, Error, TEXT("%s"), *(*ErrorIter).Message); } } if ( CurExecutionInfo.Warnings.Num() > 0 ) { SET_WARN_COLOR(COLOR_YELLOW); CLEAR_WARN_COLOR(); for ( TArray<FString>::TConstIterator WarningIter( CurExecutionInfo.Warnings ); WarningIter; ++WarningIter ) { UE_LOG(LogAutomationTest, Warning, TEXT("%s"), **WarningIter ); } } if ( CurExecutionInfo.LogItems.Num() > 0 ) { //InContext->Logf( *FString::Printf( TEXT("%s"), *NSLOCTEXT("UnrealEd", "AutomationTest_LogItems", "Log Items").ToString() ) ); for ( TArray<FString>::TConstIterator LogItemIter( CurExecutionInfo.LogItems ); LogItemIter; ++LogItemIter ) { UE_LOG(LogAutomationTest, Log, TEXT("%s"), **LogItemIter ); } } //InContext->Logf( TEXT("") ); } }
void FAutomationControllerManager::HandleRunTestsReplyMessage( const FAutomationWorkerRunTestsReply& Message, const IMessageContextRef& Context ) { // If we should commit these results if (Message.ExecutionCount == ExecutionCount) { FAutomationTestResults TestResults; TestResults.State = Message.Success ? EAutomationState::Success : EAutomationState::Fail; TestResults.Duration = Message.Duration; // Mark device as back on the market int32 ClusterIndex; int32 DeviceIndex; verify(DeviceClusterManager.FindDevice(Context->GetSender(), ClusterIndex, DeviceIndex)); TestResults.GameInstance = DeviceClusterManager.GetClusterDeviceName(ClusterIndex, DeviceIndex); TestResults.Errors = Message.Errors; TestResults.Logs = Message.Logs; TestResults.Warnings = Message.Warnings; // Verify this device thought it was busy TSharedPtr <IAutomationReport> Report = DeviceClusterManager.GetTest(ClusterIndex, DeviceIndex); check(Report.IsValid()); Report->SetResults(ClusterIndex,CurrentTestPass, TestResults); #if WITH_EDITOR FMessageLog AutomationTestingLog("AutomationTestingLog"); AutomationTestingLog.Open(); #endif for (TArray<FString>::TConstIterator ErrorIter(Message.Errors); ErrorIter; ++ErrorIter) { GLog->Logf(ELogVerbosity::Error, TEXT("%s"), **ErrorIter); #if WITH_EDITOR AutomationTestingLog.Error(FText::FromString(*ErrorIter)); #endif } for (TArray<FString>::TConstIterator WarningIter(Message.Warnings); WarningIter; ++WarningIter) { GLog->Logf(ELogVerbosity::Warning, TEXT("%s"), **WarningIter); #if WITH_EDITOR AutomationTestingLog.Warning(FText::FromString(*WarningIter)); #endif } for (TArray<FString>::TConstIterator LogItemIter(Message.Logs); LogItemIter; ++LogItemIter) { GLog->Logf(ELogVerbosity::Log, TEXT("%s"), **LogItemIter); #if WITH_EDITOR AutomationTestingLog.Info(FText::FromString(*LogItemIter)); #endif } if (TestResults.State == EAutomationState::Success) { FString SuccessString = FString::Printf(TEXT("...Automation Test Succeeded (%s)"), *Report->GetDisplayName()); GLog->Logf(ELogVerbosity::Log, *SuccessString); #if WITH_EDITOR AutomationTestingLog.Info(FText::FromString(*SuccessString)); #endif } else { FString FailureString = FString::Printf(TEXT("...Automation Test Failed (%s)"), *Report->GetDisplayName()); GLog->Logf(ELogVerbosity::Log, *FailureString); #if WITH_EDITOR AutomationTestingLog.Error(FText::FromString(*FailureString)); #endif } // Device is now good to go DeviceClusterManager.SetTest(ClusterIndex, DeviceIndex, NULL); } // Remove the running test RemoveTestRunning(Context->GetSender()); }