Files
UnrealEngineUWP/Engine/Source/Developer/FunctionalTesting/Classes/FunctionalTestingManager.h
Steve Robb 0756ef15b9 Delegate comparisons deprecated, lots of other associated code deprecated, and lots of warning fixups:
* Multicast delegate Add* calls now return FDelegateHandles, and Remove* calls are now all deprecated, except for a new Remove function which takes a FDelegateHandle.
* New FConsoleManager::RegisterConsoleVariableSink_Handle and UnregisterConsoleVariableSink_Handle functions which work in terms of FConsoleVariableSinkHandle.
* Timer calls which don't take FTimerHandles are deprecated.
* FTicker::AddTicker now returns an FDelegateHandle and is removed by an overloaded Remove function.
* DEFINE_ONLINE_DELEGATE* macros now define _Handle variants of the Add/Remove functions which return/take handles.
* Various other handle-based registration changes.
* Some unity build fixes.
* Some simplification of delegate code.
* Fixes for lots of existing code to use handle-based registration and unregistration.

#codereview robert.manuszewski

[CL 2400883 by Steve Robb in Main branch]
2015-01-08 09:29:27 -05:00

91 lines
2.8 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Misc/AutomationTest.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "FunctionalTestingManager.generated.h"
class UWorld;
namespace FFunctionalTesting
{
extern const TCHAR* ReproStringTestSeparator;
extern const TCHAR* ReproStringParamsSeparator;
}
UCLASS(BlueprintType, MinimalAPI)
class UFunctionalTestingManager : public UBlueprintFunctionLibrary
{
GENERATED_UCLASS_BODY()
UPROPERTY(Transient)
TArray<class AFunctionalTest*> TestsLeft;
UPROPERTY(Transient)
TArray<class AFunctionalTest*> AllTests;
UPROPERTY(BlueprintAssignable)
FFunctionalTestEventSignature OnSetupTests;
UFUNCTION(BlueprintCallable, Category="FunctionalTesting", meta=(WorldContext="WorldContext", CallableWithoutWorldContext ) )
/** Triggers in sequence all functional tests found on the level.
* @return true if any tests have been triggered */
static bool RunAllFunctionalTests(UObject* WorldContext, bool bNewLog = true, bool bRunLooped = false, bool bWaitForNavigationBuildFinish = true, FString FailedTestsReproString = TEXT(""));
bool IsRunning() const { return bIsRunning; }
bool IsFinished() const { return bFinished; }
bool IsLooped() const { return bLooped; }
void SetLooped(const bool bNewLooped) { bLooped = bNewLooped; }
void TickMe(float DeltaTime);
//----------------------------------------------------------------------//
// Automation logging
//----------------------------------------------------------------------//
static void SetAutomationExecutionInfo(FAutomationTestExecutionInfo* InExecutionInfo) { ExecutionInfo = InExecutionInfo; }
static void AddError(const FText& InError);
static void AddWarning(const FText& InWarning);
static void AddLogItem(const FText& InLogItem);
private:
void LogMessage(const FString& MessageString, TSharedPtr<IMessageLogListing> LogListing = NULL);
protected:
static UFunctionalTestingManager* GetManager(UObject* WorldContext);
void TriggerFirstValidTest();
void SetUpTests();
void OnTestDone(class AFunctionalTest* FTest);
void OnEndPIE(const bool bIsSimulating);
bool RunFirstValidTest();
void NotifyTestDone(class AFunctionalTest* FTest);
void SetReproString(FString ReproString);
void AllTestsDone();
void OnWorldCleanedUp(UWorld* World, bool bSessionEnded, bool bCleanupResources);
virtual UWorld* GetWorld() const;
bool bIsRunning;
bool bFinished;
bool bLooped;
bool bWaitForNavigationBuildFinish;
bool bInitialDelayApplied;
uint32 CurrentIteration;
FFunctionalTestDoneSignature TestFinishedObserver;
FString GatheredFailedTestsReproString;
FString StartingReproString;
TArray<FString> TestReproStrings;
static FAutomationTestExecutionInfo* ExecutionInfo;
private:
FTimerHandle TriggerFirstValidTestTimerHandle;
};