Unreal Engine Testing Standards
1. Test Framework
- •Primary Tool: Unreal Automation Framework (Session Frontend -> Automation).
- •Test Categories:
- •
EAutomationTestFlags::EditorContext: Requires Editor (Assets open). - •
EAutomationTestFlags::ClientContext: PIE/Simulate. - •
EAutomationTestFlags::ProductFilter: Categorized as "Functional/Smoke/Product".
- •
2. Test Structure (C++)
- •Define tests using
IMPLEMENT_SIMPLE_AUTOMATION_TEST(FMyTestNamespacedClassName, "Project.Category.TestName", EAutomationTestFlags::EditorContext | ...) - •Assertions:
- •
TestTrue("Message", Condition) - •
TestFalse("Message", Condition) - •
TestEqual("Message", Actual, Expected) - •
TestNotNull("Message", ObjectPtr)
- •
3. Blueprint Automation
- •Use Functional Test Actor (
AFunctionalTest). - •Extend
FunctionalTestin Blueprint. - •Use
BeginPlay-> Setup ->OnTick/Wait-> Assert ->FinishTest(Passed/Failed).
4. CI/CD Integration
- •Run tests via Command Line:
- •
UnrealEditor-Cmd.exe "Project.uproject" -ExecCmds="Automation RunTests Project.Category; Quit" -log
- •
- •Fail build if any
Erroris logged.
5. Scope
- •Smoke Tests: Does the map load? Does the player pawn spawn?
- •Logic Tests: Does
TakeDamage()reduce HP correctly? - •Replication Tests: Does Client B see what Server A did? (Requires Multi-Process PIE tests).