Is it possible to add an AutomationTest in a game module?

I would like to add some unit tests for code contained in the game module. I’m following the documentation found at Automation Technical Guide | Unreal Engine 5.1 Documentation, registering the AutomationTest using IMPLEMENT_SIMPLE_AUTOMATION_TEST and including its corresponding RunTest method.

However, seems like the test is not registered, and never shows up in the Session Frontend > Automation list.

Are Automation Tests only intended for Engine modules? Or perhaps I’m missing an undocumented step?

Good news, AutomationTest are fully functional from Game module. I’ve got I first failing test working, just adding a source file MyClassTest.cpp inside a /Test folder in my regular game source dir containing :

#include "YourGameModule.h"
#include "AutomationTest.h"


IMPLEMENT_SIMPLE_AUTOMATION_TEST(FYourTestClass, "Core.Misc.YourCat", EAutomationTestFlags::ATF_SmokeTest)

bool FYourTestClass::RunTest( const FString& Parameters )
{

    AddError(FString::Printf(TEXT("The testing goat says NO! Hourray! Goto coding! ")));
    
    return true;
}

The test was automatically added in the Session Frontend. Nothing to do.

I’ve not longer experienced UE4 testing, but Engine/Source/Runtime/Core/Private/Tests/ should be a good starting point!

You are right!

It is working. My mistake was using ATF_Game as test flag, it leaves the test out from running in the editor. Using ATF_SmokeTest (or ATF_Editor, ATF_ApplicationMask) allows the test class to appear on the Session Frontend list.

How do you run tests marked with ATF_Game?
There are automation tests I’d like to write that would launch the game and test stuff in the world.

Nevermind - I found the answer in the source code (Engine\Source\Programs\UnrealBuildTool\System\RulesCompiler.cs). Running this command line will execute the ATF_Game tests

“%UE4EnginePath%\Build\BatchFiles\RunUAT.bat” BuildCookRun -project=%ProjectPath% -run -RunAutomationTests -unattended -nullrhi -NoP4

Did you manage to get tests hot reload? I can’t really use automation testing if I can’t reload tests