Files
UnrealEngineUWP/Engine/Source/Developer/FunctionalTesting/Classes/FunctionalTestingManager.h
Chris Gagnon 80918bea22 Merging //UE4/Dev-Main to Dev-Editor (//UE4/Dev-Editor)
#rb none

[CL 5110714 by Chris Gagnon in Dev-Editor branch]
2019-02-21 13:05:30 -05:00

105 lines
3.1 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Engine/EngineTypes.h"
#include "GameFramework/Actor.h"
#include "FunctionalTest.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "FunctionalTestingManager.generated.h"
class IMessageLogListing;
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;
UPROPERTY(BlueprintAssignable)
FFunctionalTestEventSignature OnTestsComplete;
UPROPERTY(BlueprintAssignable)
FFunctionalTestEventSignature OnTestsBegin;
/**
* Triggers in sequence all functional tests found on the level.
* @return true if any tests have been triggered
*/
UFUNCTION(BlueprintCallable, Category="FunctionalTesting", meta=(WorldContext="WorldContextObject", CallableWithoutWorldContext ) )
static bool RunAllFunctionalTests(UObject* WorldContextObject, bool bNewLog = true, bool bRunLooped = false, FString FailedTestsReproString = TEXT(""));
UE_DEPRECATED(4.18, "This function is deprecated and is no longer used. Please use the version without the bWaitForNavigationBuildFinish parameter.")
static bool RunAllFunctionalTests(UObject* WorldContextObject, bool bNewLog, bool bRunLooped, bool bWaitForNavigationBuildFinish, FString FailedTestsReproString = TEXT("")) { return RunAllFunctionalTests(WorldContextObject, bNewLog, bRunLooped, FailedTestsReproString); }
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);
protected:
static UFunctionalTestingManager* GetManager(UObject* WorldContext);
void TriggerFirstValidTest();
void SetUpTests();
void OnTestDone(class AFunctionalTest* FTest);
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 override;
bool bIsRunning;
bool bFinished;
bool bLooped;
bool bInitialDelayApplied;
uint32 CurrentIteration;
FFunctionalTestDoneSignature TestFinishedObserver;
//FString GatheredFailedTestsReproString;
FString StartingReproString;
TArray<FString> TestReproStrings;
private:
FTimerHandle TriggerFirstValidTestTimerHandle;
};
UCLASS(abstract, Blueprintable, MinimalAPI)
class APhasedAutomationActorBase : public AActor
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent, Category = "Automation")
void OnFunctionalTestingComplete();
UFUNCTION(BlueprintImplementableEvent, Category = "Automation")
void OnFunctionalTestingBegin();
};