<div dir="ltr">Cross-posting here as well from juju-dev, since this might be more broadly helpful to the community.<div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Free Ekanayaka</b> <span dir="ltr"><<a href="mailto:free.ekanayaka@canonical.com">free.ekanayaka@canonical.com</a>></span><br>Date: 11 October 2016 at 10:57<br>Subject: New helper library for unit-testing charms<br>To: "<a href="mailto:juju-dev@lists.ubuntu.com">juju-dev@lists.ubuntu.com</a>" <<a href="mailto:juju-dev@lists.ubuntu.com">juju-dev@lists.ubuntu.com</a>><br><br><br><div dir="ltr">Hello,<div><br></div><div>I published a couple of new Python packages aimed at making unit tests for charms easier and nicer:</div><div><br></div><div><a href="https://github.com/freeekanayaka/charm-test" target="_blank">https://github.com/<wbr>freeekanayaka/charm-test</a><br></div><div><a href="https://github.com/freeekanayaka/systemfixtures" target="_blank">https://github.com/<wbr>freeekanayaka/systemfixtures</a><br></div><div><br></div><div>They implement the classic approach [0] of replacing the "boundaries" of a charm (hook tools, processes, filesystem, network, etc) with realistic fakes, so your unit tests run actual code as much as possible and you don't have to mock internal APIs that directly or indirectly interact with the boundaries (often leading to mocking explosion).</div><div><br></div><div>Besides the package documentation, you might want to have a look to the jenkins charm reactive rewrite branch [1] to see some real-world use.</div><div><br></div><div>If there's interest around this, we could move the code under the juju GitHub tree, or even merge it to the charm.unit package [2].</div><div><br></div><div>Cheers,</div><div><br></div><div>Free</div><div><br></div><div>[0] <a href="http://martinfowler.com/articles/mocksArentStubs.html" target="_blank">http://martinfowler.com/<wbr>articles/mocksArentStubs.html</a></div><div>[1] <a href="https://github.com/freeekanayaka/layer-jenkins" target="_blank">https://github.com/<wbr>freeekanayaka/layer-jenkins</a></div><div>[2] <a href="https://github.com/juju-solutions/charms.unit" target="_blank">https://github.com/juju-<wbr>solutions/charms.unit</a></div></div>
</div><br></div></div>