Skip to content

Comments

[boschshc] Boost unit test coverage#16500

Merged
lsiepel merged 1 commit intoopenhab:mainfrom
david-pace:boschshc-unit-tests
Mar 31, 2024
Merged

[boschshc] Boost unit test coverage#16500
lsiepel merged 1 commit intoopenhab:mainfrom
david-pace:boschshc-unit-tests

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 requested a review from GerdZanker as a code owner March 8, 2024 07:27
@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 force-pushed the boschshc-unit-tests branch from b321e72 to 702f4bd Compare March 31, 2024 12:24
@david-pace david-pace removed the awaiting other PR Depends on another PR label Mar 31, 2024
@david-pace david-pace requested review from jlaur and lsiepel March 31, 2024 12:36
@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
@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>
pgfeller pushed a commit to pgfeller/openhab-addons that referenced this pull request Sep 29, 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: Patrik Gfeller <patrik.gfeller@proton.me>
joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
Boosts the unit test coverage for the `boschshc` binding in `src/main/java` to 94%.

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

Signed-off-by: David Pace <dev@davidpace.de>
cipianpascu pushed a commit to cipianpascu/openhab-addons that referenced this pull request Jan 2, 2025
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: Ciprian Pascu <contact@ciprianpascu.ro>
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.

2 participants