FAutomationTestBase

Simple abstract base class for all automation tests

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Misc/AutomationTest.h

Include

#include "Misc/AutomationTest.h"

Syntax

class FAutomationTestBase

Remarks

Simple abstract base class for all automation tests

Variables

Name Description

Protected variable

bool

 

bComplexTask

Flag to indicate if this is a complex task.

Protected variable

bool

 

bRunOnSeparateThread

Flag to indicate if this test should be ran on it's own thread.

Protected variable

bool

 

bSuppressLogs

Flag to suppress logs

Protected variable

FAutomationTest ...

 

ExecutionInfo

Info related to the last execution of this test

Protected variable

FString

 

TestName

Name of the test

Protected variable

FString

 

TestParameterContext

Context of the test

Constructors

Name Description

Public function

FAutomationTestBase

(
    const FString & InName,
    const bool bInComplexTask
)

Constructor

Destructors

Name Description

Public function Virtual

~FAutomationTestBase()

Destructor

Functions

Name Description

Public function Virtual

void

 

AddAnalyticsItem

(
    const FString & InAnalyticsItem
)

Adds a analytics string to parse later

Public function

void

 

AddCommand

(
    IAutomationNetworkCommand * New...
)

Enqueues a new latent network command.

Public function

void

 

AddCommand

(
    IAutomationLatentCommand * NewC...
)

Enqueues a new latent command.

Public function Virtual

void

 

AddError

(
    const FString & InError,
    int32 StackOffset
)

Adds an error message to this test

Public function Virtual

void

 

AddErrorIfFalse

(
    bool bCondition,
    const FString & InError,
    int32 StackOffset
)

Adds an error message to this test if the condition is false

Public function Virtual

void

 

AddErrorS

(
    const FString & InError,
    const FString & InFilename,
    int32 InLineNumber
)

Adds an error message to this test

Public function Virtual

void

 

AddEvent

(
    const FAutomationEvent & InEvent,
    int32 StackOffset
)

Adds an automation event directly into the execution log.

Public function

void

 

AddExpectedError

(
    FString ExpectedPatternString,
    EAutomationExpectedErrorFlags::Matc ...,
    int32 Occurrences
)

Adds a regex pattern to an internal list that this test will expect to encounter in error or warning logs during its execution.

Public function Virtual

void

 

AddInfo

(
    const FString & InLogItem,
    int32 StackOffset
)

Adds a log item to this test

Public function Virtual

void

 

AddWarning

(
    const FString & InWarning,
    int32 StackOffset
)

Adds a warning to this test

Public function Virtual

void

 

AddWarningS

(
    const FString & InWarning,
    const FString & InFilename,
    int32 InLineNumber
)

Adds an warning message to this test

Public function

void

 

ClearExecutionInfo()

Clear any execution info/results from a prior running of this test

Public function Const

void

 

GenerateTestNames

(
    TArray < FAutomationTestInfo >& Tes...
)

Helper function that will generate a list of sub-tests via GetTests

Protected function Const

FString

 

GetBeautifiedTestName()

Returns the beautified test name

Public function Const

void

 

GetExecutionInfo

(
    FAutomationTestExecutionInfo & OutI...
)

Populate the provided execution info object with the execution info contained within the test.

Public function Const

void

 

GetExpectedErrors

(
    TArray < FAutomationExpectedError > ...
)

Populate the provided expected errors object with the expected errors contained within the test.

Public function Const

uint32

 

GetRequiredDeviceNum()

Pure virtual method; returns the number of participants for this test

Public function Virtual Const

FString

 

GetTestAssetPath

(
    const FString & Parameter
)

Allows navigation to the asset associated with the test if there is one.

Public function Const

FString

 

GetTestContext()

Gets the parameter context of the test.

Public function Const

uint32

 

GetTestFlags()

Pure virtual method; returns the flags associated with the given automation test

Public function Const

FString

 

GetTestName()

Gets the C++ name of the test.

Public function Virtual Const

FString

 

GetTestOpenCommand

(
    const FString & Parameter
)

Return an exec command to open the test associated with this parameter.

Protected function Const

void

 

GetTests

(
    TArray < FString >& OutBeautifiedNa...,
    TArray < FString >& OutTestCommands
)

Asks the test to enumerate variants that will all go through the "RunTest" function with different parameters (for load all maps, this should enumerate all maps to load)\

Public function Virtual Const

int32

 

GetTestSourceFileLine()

Gets the line number where this test was defined.

Public function Virtual Const

int32

 

GetTestSourceFileLine

(
    const FString & InTestName
)

Gets the line number where this test was defined.

Public function Virtual Const

FString

 

GetTestSourceFileName

(
    const FString & InTestName
)

Gets the filename where this test was defined.

Public function Virtual Const

FString

 

GetTestSourceFileName()

Gets the filename where this test was defined.

Public function Const

bool

 

HasAnyErrors()

Returns whether this test has any errors associated with it or not

Public function

bool

 

HasMetExpectedErrors()

Returns whether this test has encountered all expected errors defined for it

Public function Const

const bool

 

IsComplexTask()

Is this a complex tast - if so it will be a stress test.

Public function Const

const bool

 

IsRanOnSeparateThread()

Public function

void

 

PopContext()

Public function

void

 

PushContext

(
    const FString & Context
)

Protected function

bool

 

RunTest

(
    const FString & Parameters
)

Virtual call to execute the automation test.

Public function

void

 

SetSuccessState

(
    bool bSuccessful
)

Forcibly sets whether the test has succeeded or not

Protected function Virtual

void

 

SetTestContext

(
    FString Context
)

Sets the parameter context of the test.

Public function Virtual

bool

 

SuppressLogs()

If true logs will not be included in test events

Public function

bool

 

TestEqual

(
    const FString & What,
    double Actual,
    double Expected,
    double Tolerance
)

Public function

bool

 

TestEqual

(
    const FString & What,
    float Actual,
    float Expected,
    float Tolerance
)

Public function

bool

 

TestEqual

(
    const FString & What,
    const TCHAR * Actual,
    const FString & Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    FVector Actual,
    FVector Expected,
    float Tolerance
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    double Actual,
    double Expected,
    double Tolerance
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    float Actual,
    float Expected,
    float Tolerance
)

Public function

bool

 

TestEqual

(
    const FString & What,
    const ValueType& Actual,
    const ValueType& Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    const ValueType& Actual,
    const ValueType& Expected
)

Logs an error if the two values are not equal.

Public function

bool

 

TestEqual

(
    const FString & What,
    const FString & Actual,
    const FString & Expected
)

Public function

bool

 

TestEqual

(
    const FString & What,
    FVector Actual,
    FVector Expected,
    float Tolerance
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    const TCHAR * Actual,
    const FString & Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    const FString & Actual,
    const FString & Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    const FString & Actual,
    const TCHAR * Expected
)

Public function

bool

 

TestEqual

(
    const FString & What,
    const TCHAR * Actual,
    const TCHAR * Expected
)

Public function

bool

 

TestEqual

(
    const FString & What,
    FColor Actual,
    FColor Expected
)

Public function

bool

 

TestEqual

(
    const FString & What,
    int32 Actual,
    int32 Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    const TCHAR * Actual,
    const TCHAR * Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    FColor Actual,
    FColor Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    int64 Actual,
    int64 Expected
)

Public function

bool

 

TestEqual

(
    const TCHAR * What,
    int32 Actual,
    int32 Expected
)

Public function

bool

 

TestEqual

(
    const FString & What,
    const FString & Actual,
    const TCHAR * Expected
)

Public function

bool

 

TestEqualInsensitive

(
    const TCHAR * What,
    const TCHAR * Actual,
    const TCHAR * Expected
)

Public function

bool

 

TestFalse

(
    const FString & What,
    bool Value
)

Public function

bool

 

TestFalse

(
    const TCHAR * What,
    bool Value
)

Logs an error if the specified Boolean value is not false.

Public function

bool

 

TestInvalid

(
    const FString & Description,
    const TSharedPtr < ValueType >& Sha...
)

Public function

bool

 

TestInvalid

(
    const TCHAR * Description,
    const TSharedPtr < ValueType >& Sha...
)

Logs an error if the given shared pointer is valid.

Public function

bool

 

TestNotEqual

(
    const TCHAR * Description,
    const ValueType& Actual,
    const ValueType& Expected
)

Logs an error if the two values are equal.

Public function

bool

 

TestNotEqual

(
    const FString & Description,
    const ValueType& Actual,
    const ValueType& Expected
)

Public function

bool

 

TestNotNull

(
    const TCHAR * What,
    ValueType* Pointer
)

Logs an error if the specified pointer is NULL.

Public function

bool

 

TestNotNull

(
    const FString & What,
    ValueType* Pointer
)

Public function

bool

 

TestNotSame

(
    const TCHAR * Description,
    const ValueType& Actual,
    const ValueType& Expected
)

Logs an error if the two values are the same object in memory.

Public function

bool

 

TestNotSame

(
    const FString & Description,
    const ValueType& Actual,
    const ValueType& Expected
)

Public function

bool

 

TestNull

(
    const TCHAR * What,
    const void * Pointer
)

Logs an error if the specified pointer is not NULL.

Public function

bool

 

TestNull

(
    const FString & What,
    const void * Pointer
)

Public function

bool

 

TestSame

(
    const TCHAR * Description,
    const ValueType& Actual,
    const ValueType& Expected
)

Logs an error if the two values are not the same object in memory.

Public function

bool

 

TestSame

(
    const FString & Description,
    const ValueType& Actual,
    const ValueType& Expected
)

Public function

bool

 

TestTrue

(
    const TCHAR * What,
    bool Value
)

Logs an error if the specified Boolean value is not true.

Public function

bool

 

TestTrue

(
    const FString & What,
    bool Value
)

Public function

bool

 

TestValid

(
    const TCHAR * Description,
    const TSharedPtr < ValueType >& Sha...
)

Logs an error if the given shared pointer is not valid.

Public function

bool

 

TestValid

(
    const FString & Description,
    const TSharedPtr < ValueType >& Sha...
)

Public function Virtual

bool

 

TreatLogErrorsAsErrors()

If true (and SuppressLogs=false) then LogErrors will be treated as test errors

Public function Virtual

bool

 

TreatLogWarningsAsErrors()

If true (and SuppressLogs=false) then LogWarnings will be treated as test errors

Deprecated Functions

Name Description

Public function

void

 

AddLogItem

(
    const FString & InLogItem
)

Use AddInfo

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback