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

Implement unit testing #172

Open
rsubtil opened this issue Mar 5, 2023 · 3 comments
Open

Implement unit testing #172

rsubtil opened this issue Mar 5, 2023 · 3 comments
Labels
enhancement New feature or request topic:core Issues or pull requests related to RetroHub itself

Comments

@rsubtil
Copy link
Member

rsubtil commented Mar 5, 2023

Unit testing will massively help in ensuring no internal behavior breaks, and it can be used to test many scenarios, such as saving game data, scraping, setting configurations, etc...

Frameworks available: gut and GdUnit3

@rsubtil rsubtil added enhancement New feature or request topic:core Issues or pull requests related to RetroHub itself labels Mar 5, 2023
@rsubtil rsubtil added the backlog Ideas to eventually implement, but not currently prioritary. label Sep 3, 2023
@rsubtil
Copy link
Member Author

rsubtil commented Jan 16, 2024

One good use case for unit testing is ensuring UI focus scenarios don't break randomly, which is something that constantly does.

Therefore this now takes some priority, thus it no longer belongs in the backlog. Like previously said, GUT and gdUnit4 seem to be the big ones right now, so which one to use should be investigated and pondered now.

@rsubtil rsubtil removed the backlog Ideas to eventually implement, but not currently prioritary. label Jan 16, 2024
@rsubtil
Copy link
Member Author

rsubtil commented Apr 14, 2024

As there's two prominent frameworks, and unit testing is crucial to ensure good UX, I'll be testing the workflow on both and grading them in different categories:

General

  • Activity (is being maintained?)
  • Support (open for bug reports? support channels available?)
  • Documentation (complete? tutorials? advanced features?)
  • CI integration (easy to integrate? works in headless mode?)

Code

  • Ease of writing tests
  • Reusable functions/components for boilerplate setup

UI

  • Injection of input actions (actions? keyboard? controller?)
  • Focus changes (can detect current focus? change focus?)
  • Scene loading (can unit test scene files? node structure?)
  • Other (TTS?)

@rsubtil
Copy link
Member Author

rsubtil commented Apr 14, 2024

After testing both GUT and gdUnit4, here are some notes I've gathered:

General

  • Activity (is being maintained?): Both are being actively maintained.
  • Support (open for bug reports? support channels available?): Both seem to show great support and openness for communication and bug reports.
  • Documentation (complete? tutorials? advanced features?): Both have great documentation
  • CI integration (easy to integrate? works in headless mode?): gdUnit4 has a slightly more straightforward CLI interface

Unit tests

  • Ease of writing tests: Both are very similar in unit test workflow. Readibility wise, gdUnit4 follows a more strictly typed approach, thus it's easier to read what a given test is testing for.
  • Reusable functions/components for boilerplate setup: Both offer setup/teardown routines, and allow extending base classes for common functionality. GUT allows for inner classes, which makes for more contained unit test files when compared to gdUnit4.

Integration tests

  • Scene loading (can unit test scene files? node structure?): While both offer unit testing of scene files, gdUnit4 was easier to setup and has better wrappers for this scenario.
  • Injection of input actions (actions? keyboard? controller?): Both can inject input actions easily. GUT supports actions, while gdUnit4 only supports raw key/mouse input events.
  • Focus changes (can detect current focus? change focus?): Both can fetch nodes and focus information.

There isn't much difference in feature-set, but gdUnit4 has some QoL decisions that I like, so we'll use this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic:core Issues or pull requests related to RetroHub itself
Projects
None yet
Development

No branches or pull requests

1 participant