Skip to content

blockly: add concept and first initial tests for logic blocks#4107

Draft
stefan-hoehn wants to merge 4 commits intoopenhab:mainfrom
stefan-hoehn:blockly_add_initial_tests
Draft

blockly: add concept and first initial tests for logic blocks#4107
stefan-hoehn wants to merge 4 commits intoopenhab:mainfrom
stefan-hoehn:blockly_add_initial_tests

Conversation

@stefan-hoehn
Copy link
Copy Markdown
Contributor

This is the first attempt to add unit and integration tests for blockly components. I based my approach on what is currently implemented in other typescript areas and in particular what has been written in agent.md.

Based on the very few "blockly logic blocks" I have created tests which could become a "template" for all other blocks as well going forward.

The integration tests provide a more complex design to evaluate if the code created is like it is expected. For this particular situation I created the test like I previously did manually in a visual way where I wanted make sure that the "multiple logic block" could be added to an if statement ("outer constraint") and also creates the right content for itself (inner code expectation). I have currently tens of these (integration) tests in a visual way for other blocks locally in my personal setup which I like to eventually move into automated tests.

All the other "unit test" rather check if the block has been implemented correctly and also enforces other things like using the right coloring. In particular here I am open to a conversation if we really should check all of this or not. Only after we are through with this conversation, I will then continue to move on with more tests and maybe even add instructions to the agent.md to allow these kind of tests very efficiently.

@florian-h05 Feel free to give me a call, so we can have an efficient conversation on that.

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 10, 2026

#5270 Bundle Size — 13.84MiB (~+0.01%).

b7fd17c(current) vs db441e9 main#5266(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change
                 Current
#5270
     Baseline
#5266
No change  Initial JS 1.41MiB 1.41MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 16.18% 25.93%
No change  Chunks 697 697
No change  Assets 816 816
No change  Modules 2817 2817
No change  Duplicate Modules 0 0
No change  Duplicate Code 0% 0%
No change  Packages 126 126
No change  Duplicate Packages 1 1
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#5270
     Baseline
#5266
Regression  JS 11.53MiB (~+0.01%) 11.53MiB
No change  CSS 901.7KiB 901.7KiB
No change  IMG 638.41KiB 638.41KiB
No change  Fonts 526.1KiB 526.1KiB
No change  Media 295.6KiB 295.6KiB
No change  Other 847B 847B

Bundle analysis reportBranch stefan-hoehn:blockly_add_initial...Project dashboard


Generated by RelativeCIDocumentationReport issue

@stefan-hoehn stefan-hoehn marked this pull request as draft April 10, 2026 19:23
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
@florian-h05 florian-h05 self-assigned this Apr 11, 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just as a initial note:
We deliberately decided to leave out unit tests from the Maven build, as in some IDEs this can lead to very slow builds or build loops (IIRC @Nadahar).
Integration tests and all other UI tooling is run on PR and main push as dedicated GHA workflow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to elaborate: It's not a problem with Eclipse, but with how the tests were being run. Maven have different phases, and tests are supposed to run in the "test" phase. That was not what was done, it was run during the "compile" or "package" phase I think. Those are correctly executed by Eclipse when rebuilding, tests are not.

It was decided that it was easier to just remove the tests than to integrate it "correctly" with Maven, and let the CI run them explicitly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the clarification! Does that mean we "only" have to make sure that these tests here are run in the test phase? Was there a particular reason why this was (or is?) not the case at that time (or still ist)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My memory is somewhat faded, but I think the reason was the NPM plugin that is used from Maven, and that it didn't handle it properly - or perhaps that it was done wrong in OH. Anyway, AFAICR, it ran tests and all together with the regular build.

If you can make the tests just run in the Maven test phase, I don't think there is a problem.

@florian-h05 florian-h05 added enhancement New feature or request main ui Main UI labels Apr 11, 2026
…maven

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request main ui Main UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants