#Separate test project for GdUnit + C#
1 messages · Page 1 of 1 (latest)
Hi checkout the examples https://github.com/godot-gdunit-labs/gdUnit4NetExamples
in your case https://github.com/godot-gdunit-labs/gdUnit4NetExamples/tree/master/Examples/Advanced/Setup/MultiProjectSetup
Complete gdUnit4Net examples repository featuring basic tutorials, advanced testing patterns, real-world demos, and best practices for C# unit testing in Godot 4. - godot-gdunit-labs/gdUnit4NetExam...
Thanks @chilly cipher . Tried to set this up but to be honest it's a lot of tooling weirdness still. For example when I issue a dotnet test, I get
:stderr: ERROR: Cannot instantiate C# script because the associated class could not be found. Script: 'res://gdunit4_testadapter_v5/GdUnit4TestRunnerScene.cs'. Make sure the script exists and contains a class definition with a name that matches the filename of the script exactly (it's case-sensitive).
And I can't for the life of me find out why the runner is looking there or what even it happens to resolve res:// to at this point. Weirdly enough, tests that don't require the Godot runtime still pass regardless of this error so I assume something is still flaky in my project setup around involving the main game project
Update: I've just realized there's a GODOT PROJECT inside the test project root. Added it, works. Thanks!
This solution ignores a very real problem with existing .NET tooling, namely the namespaces
Now new files will be littered with namespaces with src in them
So @chilly cipher apart from the namespace issue, this solution does not inherit anything that can be found in the project (like the input map, custom audio track setup, ...)
So technically it can reference code from the game project but fails at being able to test scenarios as I can't even reference an input action in the tests. Any logic present that references the input action even produces an error