Error when packaging plugin

I have two plugins, first one for my own functionality (which has two modules, one for my functionality sdk and another for automated tests) and second one for google mock tests. I use UE version 4.25.

When I go to Edit → Plugins and from there select my functionality plugin and press Package… button, I get the following error:

ERROR: Could not find definition for module ‘MockTests’, (referenced via Target → Functionality.Build.cs)

In the MockTests.uplugin I have:

"Modules": [
    {
         "Name": "MockTests",
         "Type": "DeveloperTool",
         "LoadingPhase": "Default",
    }
]

In the Functionality.uplugin I have:

"Modules: [
    {
        "Name": "FunctionalitySDK",,
        "Type": "Runtime",
        "LoadingPhase": "Default"
   },
   {
        "Name": "Tests",
        "Type": "Editor",
        "LoadingPhase": "Default"
   }
]

And in the Fuctionality.Build.cs I’ve added:

if (Target.bBuildDeveloperTools)
{
     PublicDefinitions.Add("WITH_GOOGLE_TEST=1");
     PrivateDependencyModuleNames.AddRange(new string[] { "MockTests", });
}

What is the problem here to package just my Fuctionality plugin? Does anyone knows this?

why do you have a , after MockTests ?

Bad habit from another programming language, but in the C# example above it does not change anything. You can leave it behind last element and it won’t do anything.

1 Like

Your MockTests.Build.cs exists? The Object inside is called MockTests?

using UnrealBuildTool;

public class MockTests : ModuleRules
{
	public MockTests(ReadOnlyTargetRules Target)
	: base(Target)
    {
		PrivateIncludePaths.AddRange(
			new string[] {
				"MockTests/Private"
			}
		);
		
		PrivateDependencyModuleNames.AddRange(
			new string[]
            {
				"Core",
				"CoreUObject",
				"Engine"
			}
		);
	}
}

change

PrivateDependencyModuleNames.AddRange(new string[] { "MockTests" });

It exists, but it’s not like the one in your example. I’m essentially trying to use gmock, so I used this Nans Pellicari’s UE4-GoogleTest cs settings.

I’m not sure why this didn’t work exactly, but I decided to change my strategy since I was running short on time.

So, I quit on making plugin for tests, but rather to add it directly in Source of my project, and create test application there alongside with my game project application.

For this I had to fork and clone official Unreal Engine repository, build the engine, move my entire game project to Unreal Engine repo root, add new google test module, add target to module and other necessary files (like uproject for test app), regenerate UE project files in order for UE visual studio solution to recognize vcxproj of my google test application, run some batch scripts to generate google test application within that game project. All described in guides by Eric Lemes and github repo by Nans Pellicary.