ACA Blog

ACA Blog

June 2018
« May    


Alfresco Summit part 2 – Update to automated integration testing with the Alfresco Maven SDK 1.1.1

Mano SwertsMano Swerts

In our previous blog post, Alfresco Summit part 1 : Enabling automated integration testing with Maven, we showed you how to enable automatic integration testing with the Alfresco Maven SDK. At Alfresco Summit, version 1.1.1 of this SDK has been released. This update brings a lot of improvements—using@Autowire annotations in your tests, rapid development with JRebel, etc.—, but forces us to update our configuration as well. The new Alfresco Maven SDK uses Tomcat 7 instead of Jetty to run a fresh Alfresco instance within every build. So let’s take a look how to configure our automated integration tests with this new SDK.

Creating a profile

Just as in the old SDK, we want to run the integration tests in a separate profile. The configuration for the profile hasn’t changed much:

We can than call the profile in the same way as before:

The amp-to-war profile resides in the Alfresco Maven SDK configuration and will start Tomcat 7 with the necessary configuration. This profile is now configured to automatically skip all unit tests. We override this in our profile by setting skipTests to true. In our profile we also set the maven.tomcat.forkproperty to true. This will ensure that the build execution continues when Tomcat has been started, so that our integration tests can run against it.

Starting and shutting down Tomcat

The standard configuration starts the Tomcat server at the integration-test phase and does not shut it down properly. We want to run our integration tests in that phase, so we need to make sure that Tomcat is started in an earlier phase and will be shut down after the integration tests have been run. Add the following configuration in the automated-it profile:

We configure Tomcat to start in the pre-integration-test phase. It will then shutdown in the post-integration-test phase.

Running integration tests automatically

Now we can configure the Maven Failsafe plugin to run our integration tests between these 2 phases. Just add the following configuration within the same plugins tag:

Now the integration tests will run in the integration-test phase and the generated test reports will be verified after the Tomcat server has been shutdown (in the verify phase).

That’s it. The build will now show the same behaviour as described in our previous blog post. We are now set up to actually start writing our application and the accompanying unit and integration tests. So gear up and get ready for our next blog post in our Alfresco Summit series.

P.S.: If you have any questions or suggestions feel free to contact us.

Mano Swerts
Geert Vanheusden
Toon Convents

Leave a Reply

1 Comment on "Alfresco Summit part 2 – Update to automated integration testing with the Alfresco Maven SDK 1.1.1"

newest oldest most voted
Notify of

I rarely post any comment anywhere, but I just wanted to give you a big thank you for this article.

I can’t figure out why Alfresco integrated tests are so poorly documented.
I had a a few days of “nothing-works-as-expected” before reading those two articles,
and It felt like you wrote the only useful article on the subject.

Besides being the only one talking about this, your article is very clear, well written,
and way over the average that I’m used to.

Thanks again.
Cheers from France.