Unit Testing - Integration Testing of Multiple Components (not Dummy)

Just for reference, there is also a separate thread about the Sinexcel + Battery problem → Sinexcel inverter with battery - #2 by stefan.feilmeier


Back to the original topic:

Hi @thomas.

Generally we avoid hard-wired connection between multiple OSGi bundles to avoid spaghetti code. But of course you can to that for your specific use-case. Here is a (old but simple) example of a JUnit test that activates two Components → https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.bosch.bpts5hybrid/test/io/openems/edge/bosch/bpts5hybrid/pv/BoschBpts5HybridPvTest.java

If anyway you hard-wire your Battery with Generic-ESS, you can simply rely on Generic-Ess to call the setStartStop method. Just like as it is done in the Generic-ESS Junit test → https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.ess.generic/test/io/openems/edge/ess/generic/symmetric/EssGenericManagedSymmetricImplTest.java#L47-L73

By the way, just a small note: if you want to keep the ‘fluent’ coding style in JUnit tests, there are fluent-helpers to call a method in a cycle-event, e.g.

Regards,
Stefan