Is your feature request related to a problem? Please describe.
Currently, all tests in GdUnitNet are executed within the Godot engine, including unit tests that don't require engine functionality. This leads to unnecessary overhead and slower test execution for pure logic tests that could run independently of the engine.
Describe the solution you'd like
Introduce a way to explicitly mark which tests require the Godot engine runtime, allowing other tests to run more efficiently outside the engine context.
Option A: Extended TestCase Attribute
Add an engine parameter to the existing TestCase attribute:
[TestCase(engine = true)]
public async Task TestWithEngineComponents()
{
var sceneRunner = ISceneRunner.Load("res://src/core/resources/scenes/TestSceneCSharp.tscn", true);
await sceneRunner.SimulateFrames(100);
// Test logic here
}
[TestCase] // or explicitly [TestCase(engine = false)]
public void TestPureLogic()
{
// Pure C# logic testing
}
Pros:
No breaking changes to existing tests
Clear and explicit opt-in for engine-required tests
Consistent with existing attribute structure
Cons:
Additional parameter might be overlooked
Default value needs careful consideration
Option B: New GodotTestCase Attribute
Introduce a new attribute specifically for engine-dependent tests:
[GodotTestCase]
public async Task TestWithEngineComponents()
{
var sceneRunner = ISceneRunner.Load("res://src/core/resources/scenes/TestSceneCSharp.tscn", true);
await sceneRunner.SimulateFrames(100);
// Test logic here
}
[TestCase]
public void TestPureLogic()
{
// Pure C# logic testing
}
Pros:
Very clear distinction between test types
No ambiguity about test requirements
Follows Single Responsibility Principle
Cons:
Breaking change requiring migration of existing tests
Additional attribute to maintain
Error Handling
When a test uses Godot engine features without the appropriate attribute/flag:
Test should fail immediately with a clear error message
Suggested error message: "This test uses Godot engine features but is not marked for engine execution. Please add [GodotTestCase] or [TestCase(engine = true)] to this test."
The framework should detect attempts to use engine features in non-engine tests, including:
Is your feature request related to a problem? Please describe.
Currently, all tests in GdUnitNet are executed within the Godot engine, including unit tests that don't require engine functionality. This leads to unnecessary overhead and slower test execution for pure logic tests that could run independently of the engine.
Describe the solution you'd like
Introduce a way to explicitly mark which tests require the Godot engine runtime, allowing other tests to run more efficiently outside the engine context.
Option A: Extended TestCase Attribute
Add an engine parameter to the existing TestCase attribute:
Pros:
Cons:
Option B: New GodotTestCase Attribute
Introduce a new attribute specifically for engine-dependent tests:
Pros:
Cons:
Error Handling
When a test uses Godot engine features without the appropriate attribute/flag:
Test should fail immediately with a clear error message Suggested error message: "This test uses Godot engine features but is not marked for engine execution. Please add [GodotTestCase] or [TestCase(engine = true)] to this test."
The framework should detect attempts to use engine features in non-engine tests, including: