Hi,
We are currently investigating the possibility of adding unit tests to the C++ code of our game project, and before adding an external testing setup, we noticed that Flax already has a native testing infrastructure based on Catch2.
From what we understand so far:
- The engine tests are located in
Source/Engine/Tests. - They use Catch2 (
ThirdParty/catch2/catch.hpp). FlaxTestsTarget, defined inSource/FlaxTests.Build.cs, builds theFlaxTestsexecutable and adds theTestsmodule.FlaxTestsTarget::SelectReferencedTarget()also looks specifically for a target namedFlaxNativeTestsin referenced projects, although we couldn’t find such a target defined anywhere in the FlaxEngine repository.
We built FlaxTestsTarget successfully and ran FlaxTests.exe. We also tried FlaxTests.exe -help, expecting perhaps some information about its usage, but that simply started the Flax tests.
So we wonder if this testing framework is intended to be usable by game projects, or if FlaxTestsTarget and FlaxNativeTests are mainly internal framework for testing Flax itself.
For example, let’s say we have a game module:
public class Game : GameModule
{
// ...
}
and we want to write Catch2 tests for some of its native C++ code, is there an intended way to define a test module/target in the game project and run it using Flax’s existing testing infrastructure?
Or would you instead recommend implementing a separate testing solution for the game code?
We mainly try to understand the intended workflow before building something around what might be an internal implementation detail.
Thanks ![]()