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

**URL:** <https://community.openems.io/t/unit-testing-integration-testing-of-multiple-components-not-dummy/2005>\
**Category:** Software-Development\
**Created:** [October 11, 2023, 11:47am UTC](https://community.openems.io/t/unit-testing-integration-testing-of-multiple-components-not-dummy/2005 "2023-10-11T11:47:30Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![stefan.feilmeier](https://community.openems.io/user_avatar/community.openems.io/stefan.feilmeier/32/2585_2.png) [@stefan.feilmeier](https://community.openems.io/u/stefan.feilmeier)\
**Post date:** [January 2, 2024, 10:03pm UTC](https://community.openems.io/t/unit-testing-integration-testing-of-multiple-components-not-dummy/2005/9 "2024-01-02T22:03:10Z")

</div>

Just for reference, there is also a separate thread about the Sinexcel + Battery problem → [Sinexcel inverter with battery - #2 by stefan.feilmeier](https://community.openems.io/t/sinexcel-inverter-with-battery/2229/2)

* * *

Back to the original topic:

Hi @thomas.

> [@thomas](#):
>
> 1. I would like to write a test involving an ’ EssGenericManagedSymmetric’ and ‘MyBattery’ (with a dummy battery inverter). Is this possible, and are there any examples available where this is done? I can’t find any examples of tests where there are two ‘real’ components under test - as opposed to a single real component under test and references to only dummy components.

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](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](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.

> <https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.battery.soltaro/test/io/openems/edge/battery/soltaro/cluster/versionb/BatterySoltaroClusterVersionBImplTest.java#L54-L55>

Regards,  
Stefan

---

_[View the full topic](https://community.openems.io/t/unit-testing-integration-testing-of-multiple-components-not-dummy/2005)._
