stellarium icon indicating copy to clipboard operation
stellarium copied to clipboard

Add test configurations for Observability plugin.

Open colossatr0n opened this issue 1 year ago • 8 comments

Description

Add test configurations for Observability plugin.

Screenshots (if appropriate):

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Compiles. Only a dummy test has been added.

Test Configuration:

  • Operating system: macOS Catalina v10.15.7
  • Graphics Card: Intel Iris 1536 MB

Checklist:

  • [x] My code follows the code style of this project.
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation (header file)
  • [ ] I have updated the respective chapter in the Stellarium User Guide
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules

colossatr0n avatar Aug 14 '22 14:08 colossatr0n

This compiles, but I haven't been able to figure out how to actually run the tests. I followed the instructions in BUILDING.md, but I'm not sure from which directory I'm supposed to run make test or ctest --output-on-failure (e.g. root dir, build/macosx dir, or the plugin test dir). ctest keeps saying that no tests were found.

Also, I have ENABLE_TESTING set to ON. Any suggestions?

colossatr0n avatar Aug 14 '22 14:08 colossatr0n

Please try run tests within QtCreator

alex-w avatar Aug 14 '22 14:08 alex-w

I fear unit tests will not work for this plugin due core class (singleton)

alex-w avatar Aug 14 '22 14:08 alex-w

Can you elaborate on how to do it through QtCreator?

I would like to get the dummy test working just so I can start looking into refactoring the plugin.

colossatr0n avatar Aug 14 '22 14:08 colossatr0n

Can you elaborate on how to do it through QtCreator?

ENABLE_TESTING property should be set ON in QtCreator and after run cmake on bottom bar you will see extra section for unit testing

alex-w avatar Aug 14 '22 15:08 alex-w

Awesome, found it. Thank you!

colossatr0n avatar Aug 14 '22 15:08 colossatr0n

Any progress here?

gzotti avatar Sep 19 '22 19:09 gzotti

I've made progress on this. I've been testing out the feasibility of using the FakeIt mocking testing lib, which would allow for running tests against functionalities that use StelCore. Still working on getting a complete test running, but if I can, this would at least allow tests to be written for the Observability plugin while it's being refactored.

colossatr0n avatar Sep 20 '22 14:09 colossatr0n