In my quest to learn more about UE 5.0 (Github release
branch) I’m writing some automated tests.
I have a very simple functional test that works every time I try to run it – every time EXCEPT the first time.
The first time (and only the first time) I try to run it in the editor, UE5 engine code logs errors which are interpreted as the test failing. Each subsequent time I run the tests, all tests pass.
The errors are being generated by calling FAutomationEditorCommonUtils::CreateNewMap()
.
Subsequent attempts to run the tests work fine. No errors are printed. It’s only the very first time that I try to run the test that I’m getting these errors.
Here are the errors being logged:
EditCondition attempted to use an invalid operand "WorldPartition". [D:\Dev\UE_5.0.git\Engine\Source\Editor\PropertyEditor\Private\EditConditionParser.cpp(736)]
EditCondition attempted to use an invalid operand "TextureSizingType" (value error). [D:\Dev\UE_5.0.git\Engine\Source\Editor\PropertyEditor\Private\EditConditionParser.cpp(736)]
Note that my default map that loads in the editor does not use World Partitions. It’s a UE4 type map, very simple.
Here is the code I’m running:
#include "Misc/AutomationTest.h"
#include "Tests/AutomationEditorCommon.h"
BEGIN_DEFINE_SPEC(FSimpleTest, "My.FSimpleTest",
EAutomationTestFlags::EditorContext | EAutomationTestFlags::ProductFilter)
END_DEFINE_SPEC(FSimpleTest);
void FSimpleTest::Define()
{
It("Should not log errors", [this]()
{
// this line logs errors ONLY THE FIRST TIME it runs in the editor
UWorld* World = FAutomationEditorCommonUtils::CreateNewMap();
});
It("Should not log errors either", [this]()
{
// this does NOT log errors
UWorld* World = FAutomationEditorCommonUtils::CreateNewMap();
});
}
It seems to be related to my default Level. If before running the tests I manually switch to some other level, I don’t see any errors.
This isn’t a huge issue since I can work around it, but ideally I’d like to clean this up so that there aren’t any errors at all, or at the very minimum I can work around the expected-and-not-really-error condition of CreateNewMap()
failing the first time it is run.
Note that I found some Editor tests in System.Promotion.Project Promotion Pass
that are also using FAutomationEditorCommonUtils::CreateNewMap()
and it too is failing the first time I try to run it with exactly the same errors, but it works on subsequent attempts.
If you can help provide insight into what might be going on here and how I can fix this, I’ll really appreciate it. Please and thank you!