Download

How can I integrate Visual Studio's built in Unit Testing?

I am trying to make a new project inside of the Unreal Engine’s solution that can be used for unit testing. I go to “Add New” and select “Native Unit Test Project” and it makes a new project. Then I include the two projects “UE4” and my custom game project “Procedural_C” to the new “Native Unit Test Project” but the references come up with warnings. When I look at them, I see the message:

The “Microsoft.VisualStudio.ProjectSystem.References.UnresolvedBuildDependencyProjectReference” reference could not be resolved.

for their “Full Path” setting.

If in add an “Assert::IsEqual(1,1);”

If I build the code at this point, everything compiles just fine. But as soon as I try to include any of the headers from my game project inside of my test project to start testing, all of a sudden I get errors saying it can’t find the headers “CoreMinimal.h” can not be found. I am assuming it has to do with the issue of linking the references.

Please tell me I am missing something. I am aware that Unreal Engine has its own “Automated Testing” system, but it doesn’t seem near as robust or easy to use as the built in unit testing inside of Visual Studio.

I have included my repository for reproduction of the issue.
https://github.com/dakishman/Procedural_C_Unreal.git

+1 :slight_smile: That would be amazing. I’ll have a lot of small utility functions that I’d really like to do dead simple unit tests for. Using the VS built in testing capabilities would be so so good. I essentially came as far as you currently, I’d like to figure this out…

I just noticed that running “Refresh Visual Studio Project” from the Editor nukes my custom VS "Native Unit Test Project. I guess I don’t know what I’m doing… lingers back to blueprint-land
¨¨