How do I get a custom Complex Automation Test to show up in session frontend?

Hi all,

So I’m trying to make a custom automated test that will open up all the maps that are located in a plugin in my project. But after implmenting the complex automated test I’m not able to see it under the Automation tab in the Session Frontend window. This is the code for the test:

IMPLEMENT_COMPLEX_AUTOMATION_TEST(FLoadAllMapsInGameTest, "Maps.LoadAllInGame", EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter)

void FLoadAllMapsInGameTest::GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const
{
	TArray<FString> FileList;
	FString ProjectDirectory = FPaths::ProjectPluginsDir();
	const FString extension = FPackageName::GetMapPackageExtension();
	IFileManager::Get().FindFiles(FileList, *ProjectDirectory, *extension);

	OutBeautifiedNames.Add(FString("Butts"));
	OutTestCommands.Add(FString("Butts2"));

	// Iterate over all files, adding the ones with the map extension..
	for (int32 FileIndex = 0; FileIndex < FileList.Num(); FileIndex++)
	{
		const FString& Filename = FileList[FileIndex];

		OutBeautifiedNames.Add(FPaths::GetBaseFilename(Filename));
		OutTestCommands.Add(Filename);
	}
}

bool FLoadAllMapsInGameTest::RunTest(const FString& Parameters)
{
	FString MapName = Parameters;
	UE_LOG(LogTemp, Error, TEXT("Running All maps in Game Test..."))
	AutomationOpenMap(MapName);
	ADD_LATENT_AUTOMATION_COMMAND(FEnqueuePerformanceCaptureCommands());

	return true;
}

Note: This was added to have something in those arrays, but even that didn’t make the test appear.

OutBeautifiedNames.Add(FString("Butts"));
OutTestCommands.Add(FString("Butts2"));

Does anyone know why this isn’t showing up?

Also I’m not sure if this line will actually get me all the map files within my plugin, please tell me if you have a better idea of how to get all the maps inside a plugin.

TArray<FString> FileList;
FString ProjectDirectory = FPaths::ProjectPluginsDir();
const FString extension = FPackageName::GetMapPackageExtension();
IFileManager::Get().FindFiles(FileList, *ProjectDirectory, *extension);

Also I have implemented the simple automated test “Placeholder test” found here: Automation Technical Guide | Unreal Engine Documentation
So I believe that my automated test plugin is set up correctly.

If you can help me out, that would be great!

-London

Hi London!

The Automation TechnicalGuide is still out of date, I think. I have a tutorial on AutomationTesting on my blog, which you may want to check out instead: https://blog…de/ue4-automation-testing

Try adding EAutomationTestFlags::ClientContext.

Cheers,
Jonathan

Hey Jonathan,

Thanks for the comment. I used your post to make my test plugin and got the IMPLEMENT_SIMPLE_AUTOMATION_TEST to work and show up, but so far I haven’t been able to get the IMPLEMENT_COMPLEX_AUTOMATION_TEST working. I tried adding

EAutomationTestFlags::ClientContext

but that didn’t help. Thanks tho

I got them to work, I think the problem was that I wasn’t including somthing in my plugins build.cs file, maybe? But I basically copied EditorTest.Build.cs and EditorTest.cpp/h and was able to get the complex automation test working.

Just for anyone else stumbling on this question, adding EAutomationTestFlags::EditorContext got them to appear in Frontend for me.

There are two things to check, one is Test Plugin of UE should be enabled, the other is the module where your test code lives should be include in uproject file.

If your module exactly is in uproject, maybe you need to regenerate your vs project.

Here is a way to regenerate vs project, which don’t use method of right click uproject

https://forums.unrealengine.com/t/generate-cpp-project-couldnt-find-unrealbuildtool/231288/15?page=3

Basically you run cmd, cd to your UBT folder, run UnrealBuildTool.exe -projectfiles -project="path to your project\project name.uproject" -game -engine -rocket -progress