2019-12-26 15:32:37 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-05-02 15:32:14 -04:00
# pragma once
2022-07-20 12:03:45 -04:00
# include "Containers/Array.h"
# include "Containers/UnrealString.h"
2019-05-02 15:32:14 -04:00
# include "CoreMinimal.h"
2022-07-20 12:03:45 -04:00
# include "HAL/Platform.h"
2024-01-08 14:56:28 -05:00
# include "IAutomationReport.h"
2019-05-02 15:32:14 -04:00
# include "UObject/Object.h"
2022-07-20 12:03:45 -04:00
# include "UObject/ObjectMacros.h"
2019-05-02 15:32:14 -04:00
# include "UObject/SoftObjectPath.h"
2022-07-20 12:03:45 -04:00
# include "UObject/UObjectGlobals.h"
2019-05-02 15:32:14 -04:00
# include "AutomationControllerSettings.generated.h"
/*
2024-01-08 14:56:28 -05:00
* Describes a base filter for a test group .
2019-05-02 15:32:14 -04:00
*/
USTRUCT ( )
2024-01-08 14:56:28 -05:00
struct FAutomatedTestFilterBase
2019-05-02 15:32:14 -04:00
{
2024-01-08 14:56:28 -05:00
GENERATED_BODY ( )
2019-05-02 15:32:14 -04:00
public :
2024-01-08 14:56:28 -05:00
FAutomatedTestFilterBase ( FString InContains , bool InMatchFromStart = false , bool InMatchFromEnd = false )
2021-06-23 17:51:32 -04:00
: Contains ( InContains ) , MatchFromStart ( InMatchFromStart ) , MatchFromEnd ( InMatchFromEnd )
2019-05-02 15:32:14 -04:00
{
}
2024-01-08 14:56:28 -05:00
FAutomatedTestFilterBase ( ) : FAutomatedTestFilterBase ( TEXT ( " " ) ) { }
virtual ~ FAutomatedTestFilterBase ( ) { }
2019-05-02 15:32:14 -04:00
/** String that the test must contain */
UPROPERTY ( Config )
FString Contains ;
/** If true start matching from the start of the string, else anywhere */
UPROPERTY ( Config )
bool MatchFromStart ;
2021-06-23 17:51:32 -04:00
/** If true start matching from the end of the string, else anywhere */
UPROPERTY ( Config )
2024-01-08 14:56:28 -05:00
bool MatchFromEnd ;
virtual bool PassesFilter ( const TSharedPtr < IAutomationReport > & InReport ) const
{
bool bMeetsMatch = true ;
if ( MatchFromStart | | MatchFromEnd )
{
if ( MatchFromStart )
{
bMeetsMatch = InReport - > GetFullTestPath ( ) . StartsWith ( Contains ) ;
}
if ( MatchFromEnd & & bMeetsMatch )
{
bMeetsMatch = InReport - > GetFullTestPath ( ) . EndsWith ( Contains ) ;
}
}
else
{
bMeetsMatch = InReport - > GetFullTestPath ( ) . Contains ( Contains ) ;
}
return bMeetsMatch ;
}
} ;
/*
* Describes a filter for a test group with exclude option .
*/
USTRUCT ( )
struct FAutomatedTestFilter : public FAutomatedTestFilterBase
{
GENERATED_BODY ( )
public :
FAutomatedTestFilter ( FString InContains , bool InMatchFromStart = false , bool InMatchFromEnd = false )
: FAutomatedTestFilterBase ( InContains , InMatchFromStart , InMatchFromEnd )
{
}
FAutomatedTestFilter ( ) : FAutomatedTestFilter ( TEXT ( " " ) ) { }
/** List of filters to exclude */
UPROPERTY ( Config )
TArray < FAutomatedTestFilterBase > Exclude ;
virtual bool PassesFilter ( const TSharedPtr < IAutomationReport > & InReport ) const override
{
bool bMeetsMatch = Super : : PassesFilter ( InReport ) ;
if ( bMeetsMatch & & ! Exclude . IsEmpty ( ) )
{
// Apply exclusion rules
for ( const FAutomatedTestFilterBase & Filter : Exclude )
{
if ( Filter . PassesFilter ( InReport ) )
{
return false ;
}
}
}
return bMeetsMatch ;
}
2019-05-02 15:32:14 -04:00
} ;
/*
* Describes a group of tests . Each group has a name and a set of filters that determine group membership
*/
USTRUCT ( )
struct FAutomatedTestGroup
{
GENERATED_USTRUCT_BODY ( )
public :
UPROPERTY ( Config )
FString Name ;
UPROPERTY ( Config )
TArray < FAutomatedTestFilter > Filters ;
} ;
/**
* Implements the Editor ' s user settings .
*/
UCLASS ( config = Engine , defaultconfig )
class AUTOMATIONCONTROLLER_API UAutomationControllerSettings : public UObject
{
GENERATED_UCLASS_BODY ( )
public :
/** List of user-defined test groups */
UPROPERTY ( Config )
TArray < FAutomatedTestGroup > Groups ;
2020-06-23 18:40:00 -04:00
/** Whether to suppress log from test results (default=false) */
2019-05-02 15:32:14 -04:00
UPROPERTY ( Config )
2020-06-23 18:40:00 -04:00
bool bSuppressLogErrors ;
2019-05-02 15:32:14 -04:00
2020-06-23 18:40:00 -04:00
/** Whether to suppress log warnings from test results (default=false) */
UPROPERTY ( Config )
bool bSuppressLogWarnings ;
2021-09-15 16:50:42 -04:00
/** Whether to treat log warnings as log errors (default=true) */
2020-12-07 17:51:46 -04:00
UPROPERTY ( Config )
2021-09-15 16:50:42 -04:00
bool bElevateLogWarningsToErrors ;
2022-02-15 11:30:13 -05:00
/** Log categories where warnings/errors will not affect the result of tests. A finer-grained way of preventing rogue systems from leading to test warnings/errors */
UPROPERTY ( Config )
TArray < FString > SuppressedLogCategories ;
2022-08-29 15:29:28 -04:00
/** Whether to keep the PIE Open in the editor at the end of a test pass (default=false) */
UPROPERTY ( Config )
bool bKeepPIEOpen ;
2023-06-14 04:56:18 -04:00
/** Whether to automatically expand Automation Tests tree subgroups that have single non-leaf item as a child (default=true) */
UPROPERTY ( Config )
bool bAutoExpandSingleItemSubgroups ;
2021-09-15 16:50:42 -04:00
private :
2020-06-23 18:40:00 -04:00
/** Whether to treat log warnings as test errors (default=true) */
2021-09-15 16:50:42 -04:00
UPROPERTY ( Config , Meta = ( DeprecatedProperty , DeprecationMessage = " Use bElevateLogWarningsToErrors instead. " ) )
2019-05-02 15:32:14 -04:00
bool bTreatLogWarningsAsTestErrors ;
2020-01-14 10:36:18 -05:00
2021-09-15 16:50:42 -04:00
public :
2020-01-14 10:36:18 -05:00
/** How long to wait between test updates (default=1sec)*/
UPROPERTY ( Config )
float CheckTestIntervalSeconds ;
/** The maximum response wait time for detecting a lost game instance (default=300sec)*/
UPROPERTY ( Config )
float GameInstanceLostTimerSeconds ;
2021-03-10 14:00:26 -04:00
/** Path to where telemetry files are saved (default=<project>/Saved/Automation/Telemetry/)*/
UPROPERTY ( Config )
FString TelemetryDirectory ;
/** Whether to reset data stored in telemetry file (default=false) */
UPROPERTY ( Config )
bool bResetTelemetryStorageOnNewSession ;
2021-09-15 16:50:42 -04:00
virtual void PostInitProperties ( ) override ;
2019-05-02 15:32:14 -04:00
} ;