Problem with generating test skeletor

I’m running create_openhab_binding_test_skeleton.cmd Supla supla command to generate test OSGi bundle for my plugin.

The problem is that generated code is not valid, i.e. it generates classes under src/test/java with names Supla.testHandlerTest and Supla.testOSGiTest - obviously those names are not valid. Also pom.xml is corrupted, my IDE cannot find parent defined here:

  <parent>
    <groupId>org.openhab.binding</groupId>
    <artifactId>pom</artifactId>
    <version>0.9.0-SNAPSHOT</version>
  </parent>

Could you help me with this? FYI I merged my branch with openhab/master.

anyone?

The skeleton script was originally for the Eclipse Smarthome project and indeed does not work flawlessly for OH. You need to correct the test class names and methods. The pom it not necessary to execute the tests as “JUnit Plugin” configuration. The pom needs smaller corrections like replacing ESH 0.9 parent with the openhab2.2snapshot parent. Just copy what other test bindings do.

Edit: I forgot to mention that newer eclipse environments (since Mars.2) do not work for OH tests at the moment. The OH target pulls in old conflicting versions of jdt.core/ui. You can manually fix this though. See:

Cheers,
David

Thanks for answer. I have one more question regarding testing. Do I need test bundle to do Unit test or I can do it binding that I’m writing? I’m asking, because I have problems with JUnit that are wrote in my binding, because when I write mvn clean test maven is not running any tests.

@Edit this is my test that is not running https://github.com/magx2/openhab2-addons/blob/supla/addons/binding/org.openhab.binding.supla/src/test/java/org/openhab/binding/supla/internal/supla/api/SuplaTokenManagerTest.java

Bump