How to execute a hello world Automation Spec (test)?

Hello everyone,

I’m trying to run a “hello world” spec in a new project and I get stucked at the very beginning of it: I don’t make it to show up in the test tree view of the Automation System window described here.

I followed the instructions I found in the documentation:

  • I created a cpp file that contains the spec itself
  • I used the macros given in the example

I compile using the “Development Editor” compilation configurationm and after that I run the editor (F5).
There, since there is no more instruction I would expect the spec to appear among the others specs in the tree view under “MySpec > Resource”, but not! See the screenshot below showing no “MySpec > Resource” in the tree view:

I would be very happy to know more about how the specs are supposed to be run whether it is in the Automation System window or anywhere else, if anyone has more input to share?

Here is the content of my file called Resource.spec.cpp, that contains the spec itself:

#include "Resource.h"

#include "Misc/AutomationTest.h"

DEFINE_SPEC(MySpecResource, "MySpec.Resource", EAutomationTestFlags::SmokeFilter | EAutomationTestFlags::ApplicationContextMask)
void MySpecResource::Define()
{
	Describe("Hello", [this]()
	{
		It("should say world when it surns", [this]() {
			TestTrue("It's true so I say 'world'!", true);
		});
	});
}

My configuration:

  • I run Windows 10
  • Unreal engine 5.1 compiled from the sources on the tag 5.1.0-release
  • Visual Studio Community 2022 version 17.4.3

Thank you very much (and a happy new year :wink: )

I figured out that tests aren’t listed until the module in which they lie is actually loaded. To do so, I had to use a dummy actor that instanciate an object of my module.

I guess there is a better proper way to achieve it, and if not I find this really disappointing!
If we must use some code to execute its tests/specs then this can not TDD/BDD methodology!

If anyone has a recommendation for doing things better here, I would be very greatful for your help :slight_smile:

I have the feeling that tests are listed via symbols. If in any case it is possible to run low level unit tests and specs for specific modules via command line, that would be awesome: give a DLL, load and execute all tests and specs symbols.