Files
UnrealEngineUWP/Engine/Source/Developer/AutomationController/Public/Interfaces/IAutomationControllerManager.h
Nick Darnell 5c3f60e315 Copying //UE4/Dev-Automation to //UE4/Dev-Main (Source: //UE4/Dev-Automation @ 3376875)
#lockdown Nick.Penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 3340659 on 2017/03/09 by nick.bullard

	Submitting Template map with update to lighting. The direction of the light was not optimal for looking down X+ for screenshots, which is what the SSF actor does be default.

Change 3340686 on 2017/03/09 by Nick.Bullard

	Updating Animaton/SetVertexColor map to use Template map setup.

Change 3364139 on 2017/03/24 by Nick.Darnell

	Automation - Removing the option to disable taking screenshots, doesn't make sense to have that any more.  Screenshot comparison in an intergal part of the tests now.
	Automation - The system now waits for the asset registry to finish loading assets before running tests.

Change 3364149 on 2017/03/24 by Nick.Darnell

	Automation - Fixing a bug with the source control not reverting the state of screenshots before marking them for delete.

Change 3364588 on 2017/03/24 by Nick.Darnell

	Removing the allow screenshots option.

Change 3364591 on 2017/03/24 by Nick.Darnell

	Automation - Making the camera functional test actor respect the delay.

Change 3364598 on 2017/03/24 by Nick.Darnell

	Automation - Disabling Noisy rendering features now actually disables TAA, instead of enabling FXAA.

Change 3364723 on 2017/03/25 by Nick.Darnell

	Automation - Fixing the client functional test runner to pass object and package path so that in the editor we can reliably load a particular map with object path, but for actually opening the map we can use the package path when running the test since that is what works at editor and in a cooked game.

Change 3366600 on 2017/03/27 by Nick.Bullard

	Adding FuntionalTest map back as selection in New Map window

Change 3367590 on 2017/03/28 by Nick.Darnell

	Automation - Fixing a bug with initial tolerence levels.  They showed as 'Low' in the UI, but the values were in fact all set to 0.  So new screenshot tests had zero tolerence for pixel differences.

	Automation - Adding some documentation to Functional Test.

Change 3367602 on 2017/03/28 by Nick.Darnell

	Automation - Forcing more things to stream in before the screenshots are taken.

Change 3367604 on 2017/03/28 by Nick.Darnell

	Automation - Adding some flare to how disabled functional test actors appear in the editor.

Change 3368024 on 2017/03/28 by mason.seay

	Added new test to map.  Disabled since it hasn't ran at all

Change 3368109 on 2017/03/28 by mason.seay

	Updating authorship on test actors

Change 3369701 on 2017/03/29 by Nick.Bullard

	Removing old Ground Truth images. Investigating why new copies were made rather than replacing original.

Change 3373253 on 2017/03/30 by Samuel.Proctor

	Test updates for Containers. Adding coverage for native containers

Change 3373294 on 2017/03/30 by Nick.Darnell

	Automation - Fixing a bug with Tolerence levels set via blueprints, now properly configuring the tolerence amounts before the screenshot is taken.

Change 3374355 on 2017/03/31 by Samuel.Proctor

	Added testing scenarios to the test actors and fixed a few typos.

[CL 3376906 by Nick Darnell in Main branch]
2017-04-03 13:59:25 -04:00

422 lines
12 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Interfaces/IAutomationReport.h"
class IAutomationControllerManager;
/** Type definition for shared pointers to instances of IAutomationControllerManager. */
typedef TSharedPtr<class IAutomationControllerManager> IAutomationControllerManagerPtr;
/** Type definition for shared references to instances of IAutomationControllerManager. */
typedef TSharedRef<class IAutomationControllerManager> IAutomationControllerManagerRef;
// Enum to indicate the state of the workers in the automation controller
namespace EAutomationControllerModuleState
{
enum Type
{
// Has workers available
Ready,
// Is running tests
Running,
// No workers available
Disabled
};
};
/**
* Enum used to set which reports to export
*/
namespace EFileExportType
{
enum Type
{
FET_Status = 0x00000001, // Export test status
FET_Warnings = 0x00000002, // Export warnings
FET_Errors = 0x00000004, // Export Errors
FET_Logs = 0x00000008, // Export logs
FET_All = 0x00000010 // Export everything
};
// Helper functions to set and check export flags
/**
* Check if a flag is set
*
* @param InMask The mask to check
* @param InFlag The flag to check
* @return True if the flag is set
*/
FORCEINLINE static bool IsSet( const uint32& InMask, const EFileExportType::Type InFlag )
{
if ( InMask & ( 1<<(uint32)InFlag ) )
{
return true;
}
return false;
}
/**
* Remove a flag
*
* @param InMask The mask to unset the flag on
* @param InFlag The flag to remove
*/
FORCEINLINE static void RemoveFlag( uint32& InMask, const EFileExportType::Type InFlag )
{
InMask &= ~( 1<<(uint32)InFlag );
}
/**
* Set a flag
*
* @param InMask The mask to set the flag on
* @param InFlag The flag to set
*/
FORCEINLINE static void SetFlag( uint32& InMask, const EFileExportType::Type InFlag )
{
InMask |= ( 1<<(uint32)InFlag );
}
};
namespace EAutomationDeviceGroupTypes
{
enum Type
{
MachineName, // Group by machine name
Platform, // Group by platform
OSVersion, // Group by operating system version
Model, // Group by machine model
GPU, // Group by GPU
CPUModel, // Group by CPU Model
RamInGB, // Group by RAM in gigabytes
RenderMode, // Group by RenderMode (D3D11_SM5, OpenGL_SM4, etc)
Max
};
static FText ToName( const Type DeviceGroupType )
{
switch( DeviceGroupType )
{
case MachineName: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_MachineName", "Machine Name");
case Platform: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_Platform", "Platform");
case OSVersion: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_OSVersion", "OS Version");
case Model: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_Model", "Model");
case GPU: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_GPU", "GPU");
case CPUModel: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_CPUModel", "CPU Model");
case RamInGB: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_RAM", "RAM in GB");
case RenderMode: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_RenderMode", "Render Mode");
default: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_InvalidOrMax", "InvalidOrMax");
}
}
static FText ToDescription(const Type DeviceGroupType)
{
switch( DeviceGroupType )
{
case MachineName: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_MachineName", "Group devices based off their machine name");
case Platform: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_Platform", "Group devices based off their platform");
case OSVersion: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_OSVersion", "Group devices based off their OS version");
case Model: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_Model", "Group devices based off their device model");
case GPU: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_GPU", "Group devices based off their GPU");
case CPUModel: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_CPUModel", "Group devices based off their CPU model");
case RamInGB: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_RAM", "Group devices based off memory (in GB)");
case RenderMode: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroupTip_RenderMode", "Group devices based off the current render mode");
default: return NSLOCTEXT("AutomationTest", "AutomationDeviceGroup_InvalidOrMax", "InvalidOrMax");
}
}
}
/** Console command delegate type (takes no arguments.) This is a void callback function. */
DECLARE_MULTICAST_DELEGATE(FOnAutomationControllerReset);
/** Console command delegate type (takes no arguments.) This is a void callback function. */
DECLARE_MULTICAST_DELEGATE(FOnAutomationControllerTestsRefreshed);
/** Delegate for setting the automation controller status in the UI */
DECLARE_MULTICAST_DELEGATE_OneParam(FOnAutomationControllerManagerTestsAvailable, EAutomationControllerModuleState::Type);
/** Delegate to call when the automation controller is shutdown. */
DECLARE_MULTICAST_DELEGATE(FOnAutomationControllerManagerShutdown);
/** Delegate to call when the tests are complete. */
DECLARE_MULTICAST_DELEGATE(FOnAutomationControllerTestsComplete);
/**
* Interface for AutomationController .
*/
class IAutomationControllerManager
{
public:
/**
* Broadcast a request for workers to ping if they are available.
*
* @param InSessionID the session ID to run the test on.
*/
virtual void RequestAvailableWorkers( const FGuid& InSessionId ) = 0;
/** Send request for tests that are available to run. */
virtual void RequestTests() = 0;
/**
* Resets all enabled tests to be able to run during Tick by local/remote machines.
*
* @param bIsLocalSeesion Indicate if this is a local session. We do not time out local session automation tests.
*/
virtual void RunTests( const bool bIsLocalSession = false ) = 0;
/** Stops all running tests. */
virtual void StopTests() = 0;
/** Initializes the automation controller. */
virtual void Init() = 0;
/**
* Request an asset to be loaded in the editor.
*
* @param InAssetName The asset name.
*/
virtual void RequestLoadAsset( const FString& InAssetName ) = 0;
/** Tick function that will execute enabled tests for different device clusters. */
virtual void Tick() = 0;
/**
* Sets the number of test passes.
*
* @param InNumPasses The number of test passes to perform.
*/
virtual void SetNumPasses(const int32 InNumPasses) = 0;
/**
* Get the number of test passes.
*
* @return Number of passes.
*/
virtual int32 GetNumPasses() = 0;
/**
* Returns if analytics should be sent
*/
virtual bool IsSendAnalytics() const = 0;
/**
* Sets if analytics should be sent
*/
virtual void SetSendAnalytics(const bool bNewValue) = 0;
/**
* Filters the visible list of tests.
*/
virtual void SetFilter( TSharedPtr< AutomationFilterCollection > InFilter ) = 0;
/**
* Gives the array of test results to the UI.
*/
virtual TArray <TSharedPtr <IAutomationReport> >& GetReports() = 0;
/**
* Get num devices types.
*/
virtual int32 GetNumDeviceClusters() const = 0;
/**
* Get num devices in specified cluster.
*/
virtual int32 GetNumDevicesInCluster(const int32 ClusterIndex) const = 0;
/**
* Get the group name of the specified cluster.
*/
virtual FString GetClusterGroupName(const int32 ClusterIndex) const =0;
/**
* Get name of a particular device cluster.
*/
virtual FString GetDeviceTypeName(const int32 ClusterIndex) const = 0;
/**
* Get a game instance name.
*
* @param ClusterIndex The cluster Index.
* @param DeviceIndex The Device Index.
*/
virtual FString GetGameInstanceName(const int32 ClusterIndex, const int32 DeviceIndex) const = 0;
/**
* Sets whether all visible tests are enabled or not.
*/
virtual void SetVisibleTestsEnabled(const bool bEnabled) = 0;
/**
* Returns number of tests that will be run.
*/
virtual int32 GetEnabledTestsNum() const = 0;
/**
* Gets the names of all the enabled tests.
*
* @param OutEnabledTestNames The list to populate with enabled test names.
*/
virtual void GetEnabledTestNames(TArray<FString>& OutEnabledTestNames) const = 0;
/**
* Sets any tests that match a name in the enabled tests array.
*
* @param EnabledTests An array of test names that will be enabled.
*/
virtual void SetEnabledTests(const TArray<FString>& EnabledTests) = 0;
/**
* Gets the controller's current test state.
*
* @return The test state.
*/
virtual EAutomationControllerModuleState::Type GetTestState( ) const = 0;
/**
* Sets whether the automation tests should include developer content directories.
*/
virtual void SetDeveloperDirectoryIncluded(const bool bInDeveloperDirectoryIncluded) = 0;
/**
* Returns whether the automation tests should include developer content directories.
*/
virtual bool IsDeveloperDirectoryIncluded(void) const = 0;
/**
* Sets what flags we're considering automation tests from
*/
virtual void SetRequestedTestFlags(const uint32 InRequestedTestFlags) = 0;
/**
* Check if the automation tests have completed.
*
* @return true if the tests are available.
*/
virtual const bool CheckTestResultsAvailable() const = 0;
/**
* Check if the automation tests results have errors.
*
* @return true if the tests have errors.
*/
virtual const bool ReportsHaveErrors() const = 0;
/**
* Check if the automation tests results have warnings.
*
* @return true if the tests have warnings.
*/
virtual const bool ReportsHaveWarnings() const = 0;
/**
* Check if the automation tests results have logs.
*
* @return true if the tests have logs.
*/
virtual const bool ReportsHaveLogs() const = 0;
/**
* Remove results from the automation controller module.
*/
virtual void ClearAutomationReports() = 0;
/**
* Generate an automation report.
*
* @param FileExporTypeMask The types of report to export. Warning errors etc.
*/
virtual const bool ExportReport( uint32 FileExportTypeMask ) = 0;
/**
* Check that the test we are looking to run is runnable.
*
* @param InReport The test we are checking is runnable.
* @return true if the test can be run, false if not.
*/
virtual bool IsTestRunnable( IAutomationReportPtr InReport ) const = 0;
/** Removes all callbacks. */
virtual void RemoveCallbacks() = 0;
/** Shuts down the manager. */
virtual void Shutdown() = 0;
/** Starts up the manager. */
virtual void Startup() = 0;
/** Checks if a device group flag is set. */
virtual bool IsDeviceGroupFlagSet( EAutomationDeviceGroupTypes::Type InDeviceGroup ) const = 0;
/** Toggles a device group flag. */
virtual void ToggleDeviceGroupFlag( EAutomationDeviceGroupTypes::Type InDeviceGroup ) = 0;
/** Updates the clusters when the device grouping changes. */
virtual void UpdateDeviceGroups( ) = 0;
virtual FString GetReportOutputPath() const = 0;
virtual TArray<FString> GetCheckpointFileContents() = 0;
virtual FArchive* GetCheckpointFileForWrite() = 0;
virtual void CleanUpCheckpointFile() = 0;
virtual void WriteLoadedCheckpointDataToFile() = 0;
virtual void WriteLineToCheckpointFile(FString LineToWrite) = 0;
public:
/**
* Gets the multicast delegate that is invoked when the controller manager shuts down.
*
* @return The delegate.
*/
virtual FOnAutomationControllerManagerShutdown& OnShutdown( ) = 0;
/**
* Gets the multicast delegate that is invoked when the controller has tests available.
*
* @return The delegate.
*/
virtual FOnAutomationControllerManagerTestsAvailable& OnTestsAvailable( ) = 0;
/**
* Gets the multicast delegate that is invoked when the controller's test status changes.
*
* @return The delegate.
*/
virtual FOnAutomationControllerTestsRefreshed& OnTestsRefreshed( ) = 0;
/**
* Gets the test complete multicast delegate.
*/
virtual FOnAutomationControllerTestsComplete& OnTestsComplete( ) = 0;
/**
* Gets a delegate that is invoked when the controller's reset.
*
* @return The delegate.
*/
virtual FOnAutomationControllerReset& OnControllerReset() = 0;
public:
/** Virtual destructor.*/
virtual ~IAutomationControllerManager() { }
};