I wanted to add tests to my Plugin, so I could be missing Dependencies.
I get those errors:
1>[1/12] Compile [x64] EditorUtilities.cpp
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\EditorUtilities.cpp(8): fatal error C1083: Cannot open include file: 'UObject/PackageResourceManager.h': No such file or directory
1>[2/12] Compile [x64] EngineUtilities.cpp
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\EngineUtilities.cpp(8): fatal error C1083: Cannot open include file: 'DistanceFieldAtlas.h': No such file or directory
1>[3/12] Compile [x64] CoreUObjectUtilities.cpp
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\CoreUObjectUtilities.cpp(11): fatal error C1083: Cannot open include file: 'UObject/Package.h': No such file or directory
1>[4/12] Compile [x64] CoreUtilities.cpp
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\CoreUtilities.cpp(15): fatal error C1083: Cannot open include file: 'HAL/PlatformApplicationMisc.h': No such file or directory
1>[5/12] Compile [x64] Initialization.cpp
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\Initialization.cpp(22): error C3861: 'InitEditorThreadPools': identifier not found
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\Initialization.cpp(38): error C4668: 'UE_LLT_USE_PLATFORM_FILE_STUB' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\Initialization.cpp(121): error C3861: 'InitDerivedDataCache': identifier not found
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\Initialization.cpp(122): error C3861: 'InitSlate': identifier not found
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\Initialization.cpp(123): error C3861: 'InitForWithEditorOnlyData': identifier not found
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestCommon\Initialization.cpp(124): error C3861: 'InitEditor': identifier not found
1>[6/12] Compile [x64] TestExterns.cpp
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestExterns.cpp(9): error C4273: 'GInternalProjectName': inconsistent dll linkage
1>C:\UnrealEngine\Engine\Source\Runtime\Core\Public\CoreGlobals.h(442): note: see previous definition of 'GInternalProjectName'
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestExterns.cpp(13): error C4273: 'GForeignEngineDir': inconsistent dll linkage
1>C:\UnrealEngine\Engine\Source\Runtime\Core\Public\CoreGlobals.h(443): note: see previous definition of 'GForeignEngineDir'
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestExterns.cpp(16): error C4273: 'GIsGameAgnosticExe': inconsistent dll linkage
1>C:\UnrealEngine\Engine\Source\Runtime\Core\Public\CoreGlobals.h(145): note: see previous definition of 'GIsGameAgnosticExe'
1>[7/12] Compile [x64] TestRunner.cpp
1>C:\UnrealEngine\Engine\Source\Developer\LowLevelTestsRunner\Private\TestRunner.cpp(20): fatal error C1083: Cannot open include file: 'HAL/PlatformApplicationMisc.h': No such file or directory
1>Trace file written to C:/UnrealEngine/Engine/Programs/UnrealBuildTool/Log.uba with size 6.5kb
1>Total time in Unreal Build Accelerator local executor: 4.21 seconds
1>Total execution time: 6.86 seconds
What i did:
Added a Module MyModuleTests to my Plugin. and set type to UncookedOnly
MyModuleTests.Build.cs
using UnrealBuildTool;
public class MyModuleTest : TestModuleRules
{
static MyModuleTest()
{
if (!InTestMode) return;
TestMetadata = new Metadata
{
TestName = " MyModuleTest",
TestShortName = " MyModule Test"
};
}
public MyModuleTest(ReadOnlyTargetRules Target) : base(Target)
{
PublicIncludePaths.AddRange(
new string[]
{
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[]
{
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new[]
{
"Core"
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"MyModule"
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
my only "test
#include "Time/Duration.h"
#include "TestHarness.h"
TEST_CASE_NAMED(FDurationTest, "MyModule::Time::Duration", "[MyModule][Time][SmokeFilter]")
{
REQUIRE(true);
}
Is this the correct way to set up low-level tests?