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

[boschshc] Boost unit test coverage #16500

Merged
merged 1 commit into from
Mar 31, 2024

Conversation

david-pace
Copy link
Member

Boosts the unit test coverage for the boschshc binding in src/main/java
to 94%.

Main code changes:

  • made some methods package-protected in order to be testable
  • fix typo in exception message (in class BridgeHandler)

Test code changes:

  • add lots of additional tests
  • refactor redundant tests to parameterized tests
  • add utility class providing arguments for common parameterized tests
  • fix a problem caused by wrong order of super.beforeEach() calls
  • remove unnecessary lenient() configurations

@david-pace david-pace added the test label Mar 8, 2024
@david-pace david-pace marked this pull request as draft March 8, 2024 07:27
@david-pace david-pace added the awaiting other PR Depends on another PR label Mar 8, 2024
@david-pace
Copy link
Member Author

Note: this PR is just about the commit with the unit tests, it needs to be rebased after #16400 is merged.

@david-pace david-pace marked this pull request as ready for review March 18, 2024 08:03
Boosts the unit test coverage for the `boschshc` binding in
`src/main/java`
to 94%.

Main code changes:
* made some methods package-protected in order to be testable
* fix typo in exception message (in class `BridgeHandler`)

Test code changes:
* add lots of additional tests
* refactor redundant tests to parameterized tests
* add utility class providing arguments for common parameterized tests
* fix a problem caused by wrong order of `super.beforeEach()` calls
* remove unnecessary `lenient()` configurations

Signed-off-by: David Pace <dev@davidpace.de>
@david-pace david-pace removed the awaiting other PR Depends on another PR label Mar 31, 2024
@david-pace
Copy link
Member Author

Rebased on main - can be reviewed now 😎

@lsiepel
Copy link
Contributor

lsiepel commented Mar 31, 2024

Rebased on main - can be reviewed now 😎

Do you use some kind of test coverage analysis? @holgerfriedrich uses jacoco for knx, also used in bmw binding, that seems a solid tool.

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for adding tests !

@lsiepel lsiepel merged commit 12660f1 into openhab:main Mar 31, 2024
3 checks passed
@lsiepel lsiepel added this to the 4.2 milestone Mar 31, 2024
@david-pace
Copy link
Member Author

Hi @lsiepel, I use EclEmma which uses JaCoCo under the hood. I have also used the JaCoCo Maven Plug-In in several projects in order to make the coverage visible in SonarQube, for example. It works very well 👍 The only thing I remember is that the Maven configuration can be complicated if results should be aggregated.

@david-pace david-pace deleted the boschshc-unit-tests branch April 1, 2024 07:23
lo92fr pushed a commit to lo92fr/openhab-addons that referenced this pull request Apr 30, 2024
Boosts the unit test coverage for the `boschshc` binding in `src/main/java` to 94%.

Signed-off-by: David Pace <dev@davidpace.de>
adr001db pushed a commit to adr001db/openhab-addons that referenced this pull request May 12, 2024
Boosts the unit test coverage for the `boschshc` binding in `src/main/java` to 94%.

Signed-off-by: David Pace <dev@davidpace.de>
Signed-off-by: Alexander Drent <Alex@Drent-ict.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants