Unreal engine 4 support automation test in UE4 editor.
Following is detail information from UE4 documentation.
Automation System Overview: https://docs.unrealengine.com/latest/INT/Programming/Automation/index.html
For example, we need add an automation test to check all texture size and mipmap level.
Let's finish it step by step.
Step 1: Add a new complex automation test
/**
* CheckAllTextureSizeAndMipmapTest
* Verification automation test to make sure all texture size in sepecial rang and with mipmap.
*/
IMPLEMENT_COMPLEX_AUTOMATION_TEST(FCheckAllTextureSizeAndMipmapTest, "Project.Textures.CheckAllTexture", EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter)
/**
* Requests a enumeration of all textures to check
*/
void FCheckAllTextureSizeAndMipmapTest::GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const
{//Fill OutBeautifiedNames and OutTestCommands. if there's nothing added, then no any test case show in UE4 editor.
...
OutBeautifiedNames.Add(BeautifiedFilename);
OutTestCommands.Add(Asset.ObjectPath.ToString());...
}
/**
* Execute texture checking on each texture( one texture as one test case ).
*
* @param Parameters - Full texture path to test.
* @return TRUE if the test was successful, FALSE otherwise
*/
bool FCheckAllTextureSizeAndMipmapTest::RunTest(const FString& Parameters)
{bool IsPassTest = true;
...
return IsPassTest;
}
Step 2: Check it in UE4 Editor
Compile whole project and restart UE4 editor. Open 'Session Fronted' dialog by UE4 editor menu ( 'Window' → 'Developer Tools' → 'Session Fronted').
Double click left panel to select local machine Editor. In top-right, do, select 'Automation' tab. You can find new added automation test 'Project.Textures.CheckAllTexture'. After select some test case, you can start tests by click 'Start Tests' button on the top-right area.
Step 3: Run in Teamcity/Bamboo
Automation test can be run from command or power shell script.
"..\..\..\Engine\Binaries\Win64\$ProcessName.exe" %~dp0\..\..\..\Projects\Gunjack\Gunjack.uproject -execcmds="Automation RunTests Project.Textures.CheckAllTexture;Quit" -unattended -nopause -testexit="Automation Test Queue Empty" -log=AutomationTextureLog.log