Running Cross Product Integration Tests for Atlassian Plugins

After spending a couple of days looking into multi- product and version testing I came across two techniques which are very useful, so allow me to safe you the two days and point you into the right direction :-)

Last week was the first AtlasCamp held in Europe, which is the special, developer-only camp for everyone who wants to develop extensions for Atlassian products. There were some amazing announcements, a great talk by Mike Lee (@bmf) and a good party with beer, food and the opportunity to mingle with fellow developers and Atlassians.



During AtlasCamp there is always a round of lightning talks where every attendee can sign up with a 5 minute talk. So did I.



At 42 we have been working on a cross-product plugin which we will be launching very soon. Because we want to be sure our plugin is working for different products and versions we are writing some integration tests.



After spending a couple of days looking into multi- product and version testing I came across two techniques which are very useful, so allow me to safe you the two days and point you into the right direction :-)



Define Products


For each product or version your plugin should work agains, you can define it’s configuration in your pom.xml. The definitions goes in the <configuration> tag of the maven-[product]-plugin plugin. To specify multiple instances of the same product, you can give the products instance identifiers.
With these products definitions in your pom it’s much easier and quicker to run a specific version: atlas-run—product confluence-3.3.1


<products>
<product> <!-- id, version and dataVersion are all REQUIRED parameters -->
<id>confluence</id> <!-- must be one of: jira, confluence, bamboo, fecru, crowd, refapp -->
<instanceId>confluence-3.3.1</instanceId>
<version>3.3.1</version> <!-- version of the product to use (same as productVersion) -->
<dataVersion>3.0</dataVersion> <!-- version of test data to use (same as productTestData) -->
</product>
<product>
<id>jira</id>
<version>4.2.1</version>
<dataVersion>4.0</dataVersion>
</product>
</products>>


Use TestGroups


If your plugin needs both Confluence and JIRA running at the same time your could do that with testGroups. TestGroups also allowes you to have specific test per version or product. This makes is easier to build and run your integration tests over multiple products or versions.


<<testGroups>
<testGroup>
<id>confjira</id> <!-- Unique id-->
<productIds> <!-- Define the products (can use instanceId) needed for your tests -->
<productId>confluence</productId>
<productId>jira</productId>
</productIds>
<includes> <!-- ANT based filter for which test to include in this testGroup -->
<include>it/**/confjira/*Test.java</include>
</includes>
</testGroup>
</testGroups>


Documentation


Documentation on integration tests and running them agains multiple products or version is a bit scarce, but a good start would be this page https://developer.atlassian.com/display/DOCS/Functional+Testing+with+Multiple+Products on the developers network, or use the source code from Atlassian to find some examples.



Even my slides are useful ;-)