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 unit tests against mocked test API #5

Merged
merged 3 commits into from Jan 25, 2023

Conversation

Martchus
Copy link
Contributor

  • Add mocked test API and basetest packages
    • Add substitute modules (instead of using Test::MockModule) because
      this way we don't have to depend on the original test API modules at
      all
  • Fix an error in the signature of start_gui_program which would prevent
    tests from passing
  • See https://progress.opensuse.org/issues/115022

@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Merging #5 (aa52311) into main (d4b703d) will increase coverage by 77.77%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             main        #5       +/-   ##
============================================
+ Coverage   22.22%   100.00%   +77.77%     
============================================
  Files           2         5        +3     
  Lines          18        53       +35     
============================================
+ Hits            4        53       +49     
+ Misses         14         0       -14     
Impacted Files Coverage Δ
tests/wheels/launcher.pm 100.00% <ø> (+33.33%) ⬆️
lib/OpenQA/Wheel/Launcher.pm 100.00% <100.00%> (+86.66%) ⬆️
t/01-launcher.t 100.00% <100.00%> (ø)
t/lib/basetest.pm 100.00% <100.00%> (ø)
t/lib/testapi.pm 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

* Add mocked test API and basetest packages
    * Add substitute modules (instead of using `Test::MockModule`) because
      this way we don't have to depend on the original test API modules at
      all
* Fix an error in the signature of `start_gui_program` which would prevent
  tests from passing
* See https://progress.opensuse.org/issues/115022
@Martchus
Copy link
Contributor Author

Martchus commented Jan 24, 2023

Looks like we're at 100 % test coverage. I've also set the target accordingly. The target for the patch coverage is inherited from the project target and will apparently only be shown updated after the PR has been merged.

Note that these tests only show whether the logic within the wheel itself is correct, not that the test API is used correctly or would behave correctly (as the test API is mocked).

Not sure whether the existing test that schedules the test module via isotovideo brings much additional value anymore (as it supposedly wouldn't catch any more problems as the unit tests would do). However, we can leave that test in as a springboard for better integration tests.

Copy link
Member

@kalikiana kalikiana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrmmm neat way to check what was called

@Martchus Martchus merged commit e6f5d27 into os-autoinst:main Jan 25, 2023
@Martchus Martchus deleted the coverage branch January 25, 2023 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants