Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
AutomationTest.h File Reference
#include "CoreTypes.h"
#include "Async/Async.h"
#include "Async/Future.h"
#include "Containers/Array.h"
#include "Containers/Map.h"
#include "Containers/Queue.h"
#include "Containers/Set.h"
#include "Containers/UnrealString.h"
#include "Delegates/Delegate.h"
#include "Delegates/DelegateBase.h"
#include "Delegates/DelegateInstancesImpl.h"
#include "Delegates/IDelegateInstance.h"
#include "GenericPlatform/GenericPlatformStackWalk.h"
#include "HAL/CriticalSection.h"
#include "HAL/LowLevelMemTracker.h"
#include "HAL/PlatformProcess.h"
#include "HAL/PlatformStackWalk.h"
#include "HAL/PlatformTime.h"
#include "HAL/ThreadSafeBool.h"
#include "Internationalization/Regex.h"
#include "Logging/LogVerbosity.h"
#include "Math/Color.h"
#include "Math/MathFwd.h"
#include "Math/Rotator.h"
#include "Math/UnrealMathUtility.h"
#include "Math/Vector.h"
#include "Misc/AssertionMacros.h"
#include "Misc/AutomationEvent.h"
#include "Misc/Build.h"
#include "Misc/Char.h"
#include "Misc/CString.h"
#include "Misc/DateTime.h"
#include "Misc/FeedbackContext.h"
#include "Misc/Guid.h"
#include "Misc/Optional.h"
#include "Misc/OutputDevice.h"
#include "Misc/Timespan.h"
#include "Templates/Function.h"
#include "Templates/SharedPointer.h"
#include "Templates/UnrealTemplate.h"
#include "UObject/NameTypes.h"
#include <atomic>
+ Include dependency graph for AutomationTest.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EAutomationTestFlags
 
struct  FAutomationTelemetryData
 
class  FAutomationTestExecutionInfo
 
class  FAutomationTestInfo
 
class  IAutomationLatentCommand
 
class  FThreadedAutomationLatentCommand
 
class  IAutomationNetworkCommand
 
struct  FAutomationExpectedMessage
 
struct  FAutomationScreenshotData
 
struct  FAutomationScreenshotCompareResults
 
struct  FAutomationComparisonToleranceAmount
 
class  FAutomationTestFramework
 
class  FAutomationTestFramework::FAutomationTestOutputDevice
 
class  FAutomationTestFramework::FAutomationTestMessageFilter
 
class  FAutomationTestBase
 
class  FBDDAutomationTestBase
 
class  FAutomationSpecBase
 
class  FAutomationSpecBase::FSingleExecuteLatentCommand
 
class  FAutomationSpecBase::FUntilDoneLatentCommand
 
class  FAutomationSpecBase::FAsyncUntilDoneLatentCommand
 
class  FAutomationSpecBase::FAsyncLatentCommand
 
struct  FAutomationSpecBase::FSpecIt
 
struct  FAutomationSpecBase::FSpecDefinitionScope
 
struct  FAutomationSpecBase::FSpec
 
class  FFunctionLatentCommand
 
class  FDelayedFunctionLatentCommand
 
class  FUntilCommand
 
class  IAutomationLatentCommandWithRetriesAndDelays
 

Namespaces

namespace  EAutomationExpectedMessageFlags
 

Macros

#define WITH_AUTOMATION_TESTS   (WITH_DEV_AUTOMATION_TESTS || WITH_PERF_AUTOMATION_TESTS)
 
#define SAFE_GETSTACK(VariableName, IgnoreCount, MaxDepth)
 
#define TestTrueExpr(Expression)   TestTrue(TEXT(#Expression), Expression)
 
#define DEFINE_LATENT_AUTOMATION_COMMAND(CommandName)
 
#define DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(CommandName, ParamType, ParamName)
 
#define DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(CommandName, ParamType0, ParamName0, ParamType1, ParamName1)
 
#define DEFINE_LATENT_AUTOMATION_COMMAND_THREE_PARAMETER(CommandName, ParamType0, ParamName0, ParamType1, ParamName1, ParamType2, ParamName2)
 
#define DEFINE_LATENT_AUTOMATION_COMMAND_FOUR_PARAMETER(CommandName, ParamType0, ParamName0, ParamType1, ParamName1, ParamType2, ParamName2, ParamType3, ParamName3)
 
#define DEFINE_LATENT_AUTOMATION_COMMAND_FIVE_PARAMETER(CommandName, ParamType0, ParamName0, ParamType1, ParamName1, ParamType2, ParamName2, ParamType3, ParamName3, ParamType4, ParamName4)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND(EXPORT_API, CommandName)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(EXPORT_API, CommandName, ParamType, ParamName)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(EXPORT_API, CommandName, ParamType0, ParamName0, ParamType1, ParamName1)
 
#define DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND(CommandName)    DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND(ENGINE_API, CommandName)
 
#define DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(CommandName, ParamType, ParamName)    DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(ENGINE_API, CommandName, ParamType, ParamName)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES(EXPORT_API, CommandName, RetryCount, WaitTimeBetweenRuns)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_ONE_PARAMETER(EXPORT_API, CommandName, RetryCount, WaitTimeBetweenRuns, ParamType, ParamName)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_TWO_PARAMETERS(EXPORT_API, CommandName, RetryCount, WaitTimeBetweenRuns, ParamType0, ParamName0, ParamType1, ParamName1)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_THREE_PARAMETERS(EXPORT_API, CommandName, RetryCount, WaitTimeBetweenRuns, ParamType0, ParamName0, ParamType1, ParamName1, ParamType2, ParamName2)
 
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_FOUR_PARAMETERS(EXPORT_API, CommandName, RetryCount, WaitTimeBetweenRuns, ParamType0, ParamName0, ParamType1, ParamName1, ParamType2, ParamName2, ParamType3, ParamName3)
 
#define ADD_LATENT_AUTOMATION_COMMAND(ClassDeclaration)   FAutomationTestFramework::Get().EnqueueLatentCommand(MakeShareable(new ClassDeclaration));
 
#define START_NETWORK_AUTOMATION_COMMAND(ClassDeclaration)
 
#define END_NETWORK_AUTOMATION_COMMAND(ClassDeclaration, InRoleIndex)
 
#define IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, FileName, LineNumber)
 
#define IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, FileName, LineNumber)
 
#define IMPLEMENT_NETWORKED_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, NumParticipants, FileName, LineNumber)
 
#define IMPLEMENT_BDD_AUTOMATION_TEST_PRIVATE(TClass, PrettyName, TFlags, FileName, LineNumber)
 
#define DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, FileName, LineNumber)
 
#define BEGIN_DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, FileName, LineNumber)
 
#define IMPLEMENT_SIMPLE_AUTOMATION_TEST(TClass, PrettyName, TFlags)    IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE(TClass, FAutomationTestBase, PrettyName, TFlags, __FILE__, __LINE__)
 
#define IMPLEMENT_COMPLEX_AUTOMATION_TEST(TClass, PrettyName, TFlags)    IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE(TClass, FAutomationTestBase, PrettyName, TFlags, __FILE__, __LINE__)
 
#define IMPLEMENT_NETWORKED_AUTOMATION_TEST(TClass, PrettyName, TFlags, NumParticipants)    IMPLEMENT_NETWORKED_AUTOMATION_TEST_PRIVATE(TClass, FAutomationTestBase, PrettyName, TFlags, NumParticipants, __FILE__, __LINE__)
 
#define IMPLEMENT_CUSTOM_SIMPLE_AUTOMATION_TEST(TClass, TBaseClass, PrettyName, TFlags)    IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, __FILE__, __LINE__)
 
#define IMPLEMENT_CUSTOM_COMPLEX_AUTOMATION_TEST(TClass, TBaseClass, PrettyName, TFlags)    IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, __FILE__, __LINE__)
 
#define IMPLEMENT_BDD_AUTOMATION_TEST(TClass, PrettyName, TFlags)    IMPLEMENT_BDD_AUTOMATION_TEST_PRIVATE(TClass, PrettyName, TFlags, __FILE__, __LINE__)
 
#define DEFINE_SPEC(TClass, PrettyName, TFlags)    DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, __FILE__, __LINE__)
 
#define BEGIN_DEFINE_SPEC(TClass, PrettyName, TFlags)    BEGIN_DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, __FILE__, __LINE__)
 
#define END_DEFINE_SPEC(TClass)    }; \
 
#define UTEST_EQUAL(What, Actual, Expected)
 
#define UTEST_EQUAL_TOLERANCE(What, Actual, Expected, Tolerance)
 
#define UTEST_EQUAL_INSENSITIVE(What, Actual, Expected)
 
#define UTEST_NOT_EQUAL(What, Actual, Expected)
 
#define UTEST_SAME(What, Actual, Expected)
 
#define UTEST_NOT_SAME(What, Actual, Expected)
 
#define UTEST_TRUE(What, Value)
 
#define UTEST_FALSE(What, Value)
 
#define UTEST_VALID(What, SharedPointer)
 
#define UTEST_INVALID(What, SharedPointer)
 
#define UTEST_NULL(What, Pointer)
 
#define UTEST_NOT_NULL(What, Pointer)
 

Enumerations

enum  EAutomationExpectedMessageFlags::MatchType { EAutomationExpectedMessageFlags::Exact , EAutomationExpectedMessageFlags::Contains }
 
enum class  EAutomationComparisonToleranceLevel : uint8 {
  Zero = 0x0 , Low = 0x1 , Medium = 0x2 , High = 0x3 ,
  Zero , Low , Medium , High
}
 

Functions

 DEFINE_LOG_CATEGORY_STATIC (LogLatentCommands, Log, All)
 
const TCHAREAutomationExpectedMessageFlags::ToString (EAutomationExpectedMessageFlags::MatchType ThisType)
 
 DECLARE_DELEGATE_TwoParams (FOnTestScreenshotCaptured, const TArray< FColor > &, const FAutomationScreenshotData &)
 
 DECLARE_DELEGATE_ThreeParams (FOnTestScreenshotAndTraceCaptured, const TArray< FColor > &, const TArray< uint8 > &, const FAutomationScreenshotData &)
 
 DECLARE_MULTICAST_DELEGATE_OneParam (FOnTestScreenshotComparisonComplete, const FAutomationScreenshotCompareResults &)
 
 DECLARE_MULTICAST_DELEGATE_TwoParams (FOnTestDataRetrieved, bool, const FString &)
 
 DECLARE_MULTICAST_DELEGATE_TwoParams (FOnPerformanceDataRetrieved, bool, const FString &)
 
 DECLARE_MULTICAST_DELEGATE_OneParam (FOnTestEvent, FAutomationTestBase *)
 
 DECLARE_DELEGATE (FDoneDelegate)
 

Macro Definition Documentation

◆ ADD_LATENT_AUTOMATION_COMMAND

#define ADD_LATENT_AUTOMATION_COMMAND ( ClassDeclaration)    FAutomationTestFramework::Get().EnqueueLatentCommand(MakeShareable(new ClassDeclaration));

Definition at line 3230 of file AutomationTest.h.

◆ BEGIN_DEFINE_SPEC

Definition at line 3513 of file AutomationTest.h.

◆ BEGIN_DEFINE_SPEC_PRIVATE

#define BEGIN_DEFINE_SPEC_PRIVATE ( TClass,
PrettyName,
TFlags,
FileName,
LineNumber )
Value:
class TClass : public FAutomationSpecBase \
{ \
public: \
TClass( const FString& InName ) \
static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h."); \
static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter), \
"All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h."); \
} \
virtual uint32 GetTestFlags() const override { return TFlags; } \
virtual FString GetTestSourceFileName() const override { return FileName; } \
virtual int32 GetTestSourceFileLine() const override { return LineNumber; } \
protected: \
virtual FString GetBeautifiedTestName() const override { return PrettyName; } \
virtual void Define() override;
virtual FString GetTestSourceFileName() const
virtual int32 GetTestSourceFileLine() const

Definition at line 3403 of file AutomationTest.h.

◆ DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND

#define DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND ( CommandName)     DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND(ENGINE_API, CommandName)

Definition at line 3138 of file AutomationTest.h.

◆ DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER

#define DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER ( CommandName,
ParamType,
ParamName )    DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(ENGINE_API, CommandName, ParamType, ParamName)

Definition at line 3141 of file AutomationTest.h.

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND

#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND ( EXPORT_API,
CommandName )
Value:
{ \
public: \
virtual ~CommandName() \
{} \
virtual bool Update() override; \
}

Definition at line 3099 of file AutomationTest.h.

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER

#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER ( EXPORT_API,
CommandName,
ParamType,
ParamName )
Value:
{ \
public: \
: ParamName(InputParam) \
{} \
virtual ~CommandName() \
{} \
virtual bool Update() override; \
private: \
ParamType ParamName; \
}

Definition at line 3108 of file AutomationTest.h.

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER

#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER ( EXPORT_API,
CommandName,
ParamType0,
ParamName0,
ParamType1,
ParamName1 )
Value:

Definition at line 3122 of file AutomationTest.h.

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_FOUR_PARAMETERS

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_ONE_PARAMETER

#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_ONE_PARAMETER ( EXPORT_API,
CommandName,
RetryCount,
WaitTimeBetweenRuns,
ParamType,
ParamName )
Value:
{ \
public: \
CommandName(int32 InRetryCount, double InWaitTimeBetweenRuns, ParamType ParamName) \
, ParamName(ParamName) \
{} \
virtual ~CommandName() \
{} \
virtual bool Execute() override; \
private: \
ParamType ParamName; \
}

Definition at line 3157 of file AutomationTest.h.

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_THREE_PARAMETERS

◆ DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_TWO_PARAMETERS

◆ DEFINE_LATENT_AUTOMATION_COMMAND

#define DEFINE_LATENT_AUTOMATION_COMMAND ( CommandName)
Value:
{ \
public: \
virtual ~CommandName() \
{} \
virtual bool Update() override; \
}

Definition at line 3000 of file AutomationTest.h.

◆ DEFINE_LATENT_AUTOMATION_COMMAND_FIVE_PARAMETER

◆ DEFINE_LATENT_AUTOMATION_COMMAND_FOUR_PARAMETER

◆ DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER

#define DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER ( CommandName,
ParamType,
ParamName )
Value:
{ \
public: \
: ParamName(InputParam) \
{} \
virtual ~CommandName() \
{} \
virtual bool Update() override; \
private: \
ParamType ParamName; \
}

Definition at line 3009 of file AutomationTest.h.

◆ DEFINE_LATENT_AUTOMATION_COMMAND_THREE_PARAMETER

#define DEFINE_LATENT_AUTOMATION_COMMAND_THREE_PARAMETER ( CommandName,
ParamType0,
ParamName0,
ParamType1,
ParamName1,
ParamType2,
ParamName2 )

◆ DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER

#define DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER ( CommandName,
ParamType0,
ParamName0,
ParamType1,
ParamName1 )
Value:
{ \
public: \
{} \
virtual ~CommandName() \
{} \
virtual bool Update() override; \
private: \
}

Definition at line 3023 of file AutomationTest.h.

◆ DEFINE_SPEC

Definition at line 3511 of file AutomationTest.h.

◆ DEFINE_SPEC_PRIVATE

#define DEFINE_SPEC_PRIVATE ( TClass,
PrettyName,
TFlags,
FileName,
LineNumber )
Value:
class TClass : public FAutomationSpecBase \
{ \
public: \
TClass( const FString& InName ) \
static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h."); \
static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter), \
"All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h."); \
} \
virtual uint32 GetTestFlags() const override { return TFlags; } \
virtual FString GetTestSourceFileName() const override { return FileName; } \
virtual int32 GetTestSourceFileLine() const override { return LineNumber; } \
virtual FString GetTestSourceFileName(const FString&) const override { return GetTestSourceFileName(); } \
virtual int32 GetTestSourceFileLine(const FString&) const override { return GetTestSourceFileLine(); } \
protected: \
virtual FString GetBeautifiedTestName() const override { return PrettyName; } \
virtual void Define() override; \
};

Definition at line 3376 of file AutomationTest.h.

◆ END_DEFINE_SPEC

#define END_DEFINE_SPEC ( TClass)     }; \

Definition at line 3515 of file AutomationTest.h.

◆ END_NETWORK_AUTOMATION_COMMAND

#define END_NETWORK_AUTOMATION_COMMAND ( ClassDeclaration,
InRoleIndex )
Value:
}; \
FAutomationTestFramework::Get().EnqueueNetworkCommand(MakeShareable(new F##ClassDeclaration(InRoleIndex))); \
FORCEINLINE SharedPointerInternals::TRawPtrProxy< ObjectType > MakeShareable(ObjectType *InObject)

Definition at line 3246 of file AutomationTest.h.

◆ IMPLEMENT_BDD_AUTOMATION_TEST

Definition at line 3509 of file AutomationTest.h.

◆ IMPLEMENT_BDD_AUTOMATION_TEST_PRIVATE

#define IMPLEMENT_BDD_AUTOMATION_TEST_PRIVATE ( TClass,
PrettyName,
TFlags,
FileName,
LineNumber )
Value:
class TClass : public FBDDAutomationTestBase \
{ \
public: \
TClass( const FString& InName ) \
static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h."); \
static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter), \
"All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h."); \
} \
virtual uint32 GetTestFlags() const override { return TFlags; } \
virtual bool IsStressTest() const { return false; } \
virtual uint32 GetRequiredDeviceNum() const override { return 1; } \
virtual FString GetTestSourceFileName() const override { return FileName; } \
virtual int32 GetTestSourceFileLine() const override { return LineNumber; } \
protected: \
virtual bool RunTest(const FString& Parameters) override; \
virtual FString GetBeautifiedTestName() const override { return PrettyName; } \
private: \
void Define(); \
};

Definition at line 3349 of file AutomationTest.h.

◆ IMPLEMENT_COMPLEX_AUTOMATION_TEST

◆ IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE

#define IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE ( TClass,
TBaseClass,
PrettyName,
TFlags,
FileName,
LineNumber )
Value:
class TClass : public TBaseClass \
{ \
public: \
TClass( const FString& InName ) \
:TBaseClass( InName, true ) { \
static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h."); \
static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter), \
"All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h."); \
} \
virtual uint32 GetTestFlags() const override { return ((TFlags) & ~(EAutomationTestFlags::SmokeFilter)); } \
virtual bool IsStressTest() const { return true; } \
virtual uint32 GetRequiredDeviceNum() const override { return 1; } \
virtual FString GetTestSourceFileName() const override { return FileName; } \
virtual int32 GetTestSourceFileLine() const override { return LineNumber; } \
protected: \
virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const override; \
virtual bool RunTest(const FString& Parameters) override; \
virtual FString GetBeautifiedTestName() const override { return PrettyName; } \
};

Definition at line 3294 of file AutomationTest.h.

◆ IMPLEMENT_CUSTOM_COMPLEX_AUTOMATION_TEST

Definition at line 3507 of file AutomationTest.h.

◆ IMPLEMENT_CUSTOM_SIMPLE_AUTOMATION_TEST

Definition at line 3505 of file AutomationTest.h.

◆ IMPLEMENT_NETWORKED_AUTOMATION_TEST

◆ IMPLEMENT_NETWORKED_AUTOMATION_TEST_PRIVATE

#define IMPLEMENT_NETWORKED_AUTOMATION_TEST_PRIVATE ( TClass,
TBaseClass,
PrettyName,
TFlags,
NumParticipants,
FileName,
LineNumber )
Value:
class TClass : public TBaseClass \
{ \
public: \
TClass( const FString& InName ) \
:TBaseClass( InName, false ) { \
static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h."); \
static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter), \
"All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h."); \
} \
virtual uint32 GetTestFlags() const override { return ((TFlags) & ~(EAutomationTestFlags::EditorContext | EAutomationTestFlags::CommandletContext | EAutomationTestFlags::SmokeFilter)); } \
virtual uint32 GetRequiredDeviceNum() const override { return NumParticipants; } \
virtual FString GetTestSourceFileName() const override { return FileName; } \
virtual int32 GetTestSourceFileLine() const override { return LineNumber; } \
protected: \
virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const override \
{ \
} \
virtual bool RunTest(const FString& Parameters) override; \
virtual FString GetBeautifiedTestName() const override { return PrettyName; } \
};

Definition at line 3320 of file AutomationTest.h.

◆ IMPLEMENT_SIMPLE_AUTOMATION_TEST

◆ IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE

#define IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE ( TClass,
TBaseClass,
PrettyName,
TFlags,
FileName,
LineNumber )
Value:
class TClass : public TBaseClass \
{ \
public: \
TClass( const FString& InName ) \
:TBaseClass( InName, false ) {\
static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h."); \
static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) || \
(((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter), \
"All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h."); \
} \
virtual uint32 GetTestFlags() const override { return TFlags; } \
virtual bool IsStressTest() const { return false; } \
virtual uint32 GetRequiredDeviceNum() const override { return 1; } \
virtual FString GetTestSourceFileName() const override { return FileName; } \
virtual int32 GetTestSourceFileLine() const override { return LineNumber; } \
protected: \
virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const override \
{ \
} \
virtual bool RunTest(const FString& Parameters) override; \
virtual FString GetBeautifiedTestName() const override { return PrettyName; } \
};

Macros to simplify the creation of new automation tests. To create a new test one simply must put IMPLEMENT_SIMPLE_AUTOMATION_TEST( NewAutomationClassName, AutomationClassFlags ) IMPLEMENT_COMPLEX_AUTOMATION_TEST( NewAutomationClassName, AutomationClassFlags ) in their cpp file, and then proceed to write an implementation for: bool NewAutomationTestClassName::RunTest() {} While the macro could also have allowed the code to be specified, leaving it out of the macro allows the code to be debugged more easily.

Builds supporting automation tests will automatically create and register an instance of the automation test within the automation test framework as a result of the macro.

Definition at line 3262 of file AutomationTest.h.

◆ SAFE_GETSTACK

#define SAFE_GETSTACK ( VariableName,
IgnoreCount,
MaxDepth )
Value:
if (VariableName.Num() == 0) \
{ \
/* This is a rare failure that can occur in some circumstances */ \
Info.LineNumber = 1; \
}
static TArray< FProgramCounterSymbolInfo > GetStack(int32 IgnoreCount, int32 MaxDepth=100, void *Context=nullptr)

Call GetStack, with a guarantee of a non-empty return; a placeholder "Unknown",1) is used if necessary

Definition at line 58 of file AutomationTest.h.

◆ START_NETWORK_AUTOMATION_COMMAND

#define START_NETWORK_AUTOMATION_COMMAND ( ClassDeclaration)
Value:
{ \
private:\
public: \
virtual ~F##ClassDeclaration() {} \
virtual uint32 GetRoleIndex() const override { return RoleIndex; } \
virtual void Run() override

Definition at line 3234 of file AutomationTest.h.

◆ TestTrueExpr

#define TestTrueExpr ( Expression)    TestTrue(TEXT(#Expression), Expression)

Macro version of above, uses the passed in expression as the description as well

Definition at line 1846 of file AutomationTest.h.

◆ UTEST_EQUAL

#define UTEST_EQUAL ( What,
Actual,
Expected )
Value:
if (!TestEqual(What, Actual, Expected))\
{\
return false;\
}

Macros to make it easy to test state with one-liners: they will run the appropriate test method and, if the test fail, with execute return false;, which (if placed in the main test case method) will stop the test immediately.

The error logging is already handled by the test method being called.

As a result, you can easily test things that, if wrong, would potentially crash the test:

bool FMyEasyTest::RunTest(const FString& Parameters)
{
    TArray<float> Data = GetSomeData();
    int32 Index = GetSomeIndex();
    UTEST_TRUE("Check valid index", Index < Data.Num());
    float DataItem = Data[Index];   // Won't crash, the test exited on the previous 
                                    // line if index was invalid.
    UTEST_TRUE("Check valid item", DataItem > 0.f);
}

Definition at line 3547 of file AutomationTest.h.

◆ UTEST_EQUAL_INSENSITIVE

#define UTEST_EQUAL_INSENSITIVE ( What,
Actual,
Expected )
Value:
if (!TestEqualInsensitive(What, Actual, Expected))\
{\
return false;\
}

Definition at line 3559 of file AutomationTest.h.

◆ UTEST_EQUAL_TOLERANCE

#define UTEST_EQUAL_TOLERANCE ( What,
Actual,
Expected,
Tolerance )
Value:
if (!TestEqual(What, Actual, Expected, Tolerance))\
{\
return false;\
}

Definition at line 3553 of file AutomationTest.h.

◆ UTEST_FALSE

#define UTEST_FALSE ( What,
Value )
Value:
if (!TestFalse(What, Value))\
{\
return false;\
}

Definition at line 3589 of file AutomationTest.h.

◆ UTEST_INVALID

#define UTEST_INVALID ( What,
SharedPointer )
Value:
if (!TestInvalid(What, SharedPointer))\
{\
return false;\
}

Definition at line 3601 of file AutomationTest.h.

◆ UTEST_NOT_EQUAL

#define UTEST_NOT_EQUAL ( What,
Actual,
Expected )
Value:
if (!TestNotEqual(What, Actual, Expected))\
{\
return false;\
}

Definition at line 3565 of file AutomationTest.h.

◆ UTEST_NOT_NULL

#define UTEST_NOT_NULL ( What,
Pointer )
Value:
if (!TestNotNull(What, Pointer))\
{\
return false;\
}

Definition at line 3613 of file AutomationTest.h.

◆ UTEST_NOT_SAME

#define UTEST_NOT_SAME ( What,
Actual,
Expected )
Value:
if (!TestNotSame(What, Actual, Expected))\
{\
return false;\
}

Definition at line 3577 of file AutomationTest.h.

◆ UTEST_NULL

#define UTEST_NULL ( What,
Pointer )
Value:
if (!TestNull(What, Pointer))\
{\
return false;\
}

Definition at line 3607 of file AutomationTest.h.

◆ UTEST_SAME

#define UTEST_SAME ( What,
Actual,
Expected )
Value:
if (!TestSame(What, Actual, Expected))\
{\
return false;\
}

Definition at line 3571 of file AutomationTest.h.

◆ UTEST_TRUE

#define UTEST_TRUE ( What,
Value )
Value:
if (!TestTrue(What, Value))\
{\
return false;\
}

Definition at line 3583 of file AutomationTest.h.

◆ UTEST_VALID

#define UTEST_VALID ( What,
SharedPointer )
Value:
if (!TestValid(What, SharedPointer))\
{\
return false;\
}

Definition at line 3595 of file AutomationTest.h.

◆ WITH_AUTOMATION_TESTS

Definition at line 54 of file AutomationTest.h.

Enumeration Type Documentation

◆ EAutomationComparisonToleranceLevel

Enumerator
Zero 
Low 
Medium 
High 
Zero 
Low 
Medium 
High 

Definition at line 739 of file AutomationTest.h.

Function Documentation

◆ DECLARE_DELEGATE()

DECLARE_DELEGATE ( FDoneDelegate )

◆ DECLARE_DELEGATE_ThreeParams()

◆ DECLARE_DELEGATE_TwoParams()

DECLARE_DELEGATE_TwoParams ( FOnTestScreenshotCaptured ,
const TArray< FColor > & ,
const FAutomationScreenshotData &  )

Delegate type for when a test screenshot has been captured

The first parameter is the array of the raw color data. The second parameter is the image metadata.

◆ DECLARE_MULTICAST_DELEGATE_OneParam() [1/2]

DECLARE_MULTICAST_DELEGATE_OneParam ( FOnTestEvent ,
FAutomationTestBase *  )

◆ DECLARE_MULTICAST_DELEGATE_OneParam() [2/2]

DECLARE_MULTICAST_DELEGATE_OneParam ( FOnTestScreenshotComparisonComplete ,
const FAutomationScreenshotCompareResults &  )

◆ DECLARE_MULTICAST_DELEGATE_TwoParams() [1/2]

DECLARE_MULTICAST_DELEGATE_TwoParams ( FOnPerformanceDataRetrieved ,
bool ,
const FString &  )

◆ DECLARE_MULTICAST_DELEGATE_TwoParams() [2/2]

DECLARE_MULTICAST_DELEGATE_TwoParams ( FOnTestDataRetrieved ,
bool ,
const FString &  )

◆ DEFINE_LOG_CATEGORY_STATIC()

DEFINE_LOG_CATEGORY_STATIC ( LogLatentCommands ,
Log ,
All  )