Automation

Automation

#Overview

name: Automation

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Automation is to facilitate automated testing and quality assurance processes within the Unreal Engine 5 environment. It is primarily used in the context of running automated tests, managing test execution, and interacting with the Automation Window interface.

This setting variable is primarily relied upon by the AutomationController module and the TraceInsights module, which are part of Unreal Engine’s development and debugging tools.

The value of this variable is not explicitly set in the provided code snippets. It appears to be used as a command or identifier in various contexts.

The Automation variable interacts with other components of the engine, such as:

  1. The Automation Window interface
  2. The TraceInsights module
  3. The AutomationDriver module

Developers must be aware of the following when using this variable:

  1. It’s used as a command in the engine’s command-line interface.
  2. It’s associated with the Automation Window in the Unreal Engine editor.
  3. It’s utilized in functional tests for various engine features, such as Memory Insights and Session Browser.

Best practices when using this variable include:

  1. Ensure proper initialization of the Automation systems before use.
  2. Use it in conjunction with the appropriate modules (e.g., AutomationController, TraceInsights) for effective test automation.
  3. Be mindful of its impact on performance, especially when running automated tests in a production environment.
  4. Properly handle the Automation Window to prevent interference with other UI elements during automated testing.
  5. Utilize it within the context of Unreal Engine’s testing framework for consistency and reliability in test results.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/AutomationController/Private/AutomationCommandline.cpp:516

Scope (from outer to inner):

file
class        class FAutomationExecCmd : private FSelfRegisteringExec
function     virtual bool Exec_Dev

Source code excerpt:

		bool bHandled = false;
		// figure out if we are handling this request
		if (FParse::Command(&Cmd, TEXT("Automation")))
		{
			// Early exit in case of a CVar input. ie: Automation.SkipStackWalk 1
			if (FString(Cmd).StartsWith(TEXT(".")))
			{
				return false;
			}

#Loc: <Workspace>/Engine/Source/Developer/TraceInsights/Private/Insights/Tests/FunctionalTests/MemoryInsightsTests.cpp:35

Scope (from outer to inner):

file
function     void FAutomationDriverUnrealInsightsHubMemoryInsightsTest::Define

Source code excerpt:

	BeforeEach([this]() {
		AutomationWindow = FSlateApplication::Get().GetActiveTopLevelWindow();
		const FString AutomationWindowName = TEXT("Automation");
		if (AutomationWindow->GetTitle().ToString().Contains(AutomationWindowName))
		{
			AutomationWindow->Minimize();
		}

		IUnrealInsightsModule& UnrealInsightsModule = FModuleManager::LoadModuleChecked<IUnrealInsightsModule>("TraceInsights");
		if (IAutomationDriverModule::Get().IsEnabled())
		{
			IAutomationDriverModule::Get().Disable();
		}
		IAutomationDriverModule::Get().Enable();

		Driver = IAutomationDriverModule::Get().CreateDriver();
		});

	Describe("XMLReportsUpload", [this]()
		{
			It("should verify that user can upload xml reports in Memory Insights tab", EAsyncExecution::ThreadPool, FTimespan::FromSeconds(120), [this]()
				{
					FInsightsTestUtils Utils(this);
					IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
					TSharedPtr<FInsightsManager> InsightsManager = FInsightsManager::Get();

#Loc: <Workspace>/Engine/Source/Developer/TraceInsights/Private/Insights/Tests/FunctionalTests/SessionBrowserTests.cpp:25

Scope (from outer to inner):

file
function     void FAutomationDriverUnrealInsightsSessionBrowserTest::Define

Source code excerpt:

	BeforeEach([this]() {
		AutomationWindow = FSlateApplication::Get().GetActiveTopLevelWindow();
		const FString AutomationWindowName = TEXT("Automation");
		if (AutomationWindow && AutomationWindow->GetTitle().ToString().Contains(AutomationWindowName))
		{
			AutomationWindow->Minimize();
		}

		IUnrealInsightsModule& UnrealInsightsModule = FModuleManager::LoadModuleChecked<IUnrealInsightsModule>("TraceInsights");
		if (IAutomationDriverModule::Get().IsEnabled())
		{
			IAutomationDriverModule::Get().Disable();
		}
		IAutomationDriverModule::Get().Enable();

		Driver = IAutomationDriverModule::Get().CreateDriver();
		});

	Describe("CopyRenameDeleteTrace", [this]()
		{
			It("should verify that user copy, rename and delete traces", EAsyncExecution::ThreadPool, [this]()
				{
					IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
					TSharedPtr<FInsightsManager> InsightsManager = FInsightsManager::Get();
					TestTrue("Insigts manager should not be null", InsightsManager.IsValid());