Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unit tests #1571

Closed
1 of 2 tasks
hhyyrylainen opened this issue Aug 27, 2020 · 1 comment · Fixed by #4964
Closed
1 of 2 tasks

Add support for unit tests #1571

hhyyrylainen opened this issue Aug 27, 2020 · 1 comment · Fixed by #4964

Comments

@hhyyrylainen
Copy link
Member

hhyyrylainen commented Aug 27, 2020

Until godot adds proper support we should maybe use nunit3 directly.
Godot proposal: godotengine/godot-proposals#432 (go thumbs up this)

@rhumborl
Copy link
Contributor

rhumborl commented Dec 14, 2020

I have dropped nunit3 in to the solution and done some initial investigation.
See https://github.com/rhumborl/Thrive/blob/1571_cs_unit_test_support/Thrive.Test/DummyTest.cs

  1. Unit tests must be stored separate from the main project (probably a good idea anyway).
    • If not, tests are not discovered by the console runner.
    • I was running it in Visual Studio 2019 - Test Explorer discovered them but Run All Tests came up with 0 tests found.
  2. Tests can reference code in the main Thrive assembly and run successfully for non-Godot code.
    • This should mean the majority of the core engine can be made testable.
  3. If any Godot code is executed during a test it will fail, as it is run outside the Godot environment.

Best suggestion I have currently is to make UI components as much a facade as possible, i.e. abstract Godot classes such as InputEvent to our own versions and pass them to core classes instead.

If a universally-executable runner doesn't appear as van800 was looking at in the proposal, you'll need to discuss how much test coverage vs. refactoring you might need to do.

@hhyyrylainen hhyyrylainen added the engine possibly engine related issue label Aug 13, 2021
@hhyyrylainen hhyyrylainen added this to the Release 0.6.6 milestone Mar 25, 2024
@hhyyrylainen hhyyrylainen moved this from Backburner to In progress in Thrive Planning Mar 25, 2024
Thrive Planning automation moved this from In progress to Done Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants