How to properly make a test including the handler and the things

Hi,
I’m working on a binding which so far has a very basic unit tests that test that after receiving a specific input from an API, the parsers responses are as expected. Problem is that few times already I made a normal human mistake by attaching a parser channel response to a wrong channel and silly mistakes like that…
I wanted to extend the tests, so i can also test the handler and that the channels are updated as well with the proper values. Problem is that following the OH code, it seems that there are a lot of dependencies missing when updating a channel state.

Is there any easy way to achieve that and what is the “proper” way? Maybe this sounds more like an integration test…

Cheers,
K.

You can use an integration test. This creates a full runtime for the test (or at least the necessary parts). Have a look at the itests folder for examples.

2 Likes

OK Thanks. Hoped it’s going to be something faster that I have missed but maybe will do that in a separate PR… :slight_smile: