Written by
Tirasa - INFO

Wrapping up Maven & JS best practices to achieve smooth Enduser testing

Apache Syncope 2.0 brings a bunch of new functionalities: one of the more exciting is the Enduser application: I’d suggest to read this introductory article about it before proceeding further.

In this new version, Apache Syncope provides  two web-based clients: the Admin Console, focusing mainly on administration tasks, and the Enduser, that provides basic operations for new and registered users. The former is still based on one of the best Java web frameworks around: Apache Wicket, while for the latter the development team decided to use a different approach: the Enduser front-end is built on one of the most popular Javascript frameworks, AngularJS, while the intermediate back-end still features Wicket for providing significant security enhancements.

The Apache Syncope Enduser is essentially provided as a full-working template, with declared purpose of being extremely customizable and adaptable to the various needs of the domains in which it will be deployed, in terms of UI, client-side and server-side behavior.

Testing tools

While developing the Enduser application, we faced the issue of defining an easy way to test its front-end features; in other words, we wanted to provide the Maven-driven build process with everything a developer needs to perform end-to-end testing.

The good news is that AngulaJS is shipped with its own testing framework, Protractor, an e2e testing framework for web-based application written in Angular: tests are executed in a real browser, simulating user interaction.

Protractor, which will anyway require several dependencies, runs on top of NodeJS, that needs to be installed upfront. Moreover, Protractor requires a webdriver, acting as a mediator to access browsers API; we have finally chosen the implementation provided by Selenium.

More requirements are involved: in some environments, like as Jenkins and Travis CI, simply there is no UI: what if protractor asks to interact with Firefox? Tests will not be able to run, breaking the build. Luckily, in the past years headless browsers have been developed, which don’t need any UI! For this role, we have finally chosen PantomJS.

As you can understand, Protractor needs a sort of environment to be prepared and made available, including dependency resolution, on-the-fly during the Apache Syncope (Maven-driven) build process!

Apache Maven to run them all

To close the loop, Maven installs PhantomJS, Node and Protractor: once everything has been set up, end-to-end tests are finally executed. Moreover, once everything is up and running, e2e tests can be re-executed without need of restarting anything, speeding up the test development process.

If interested in the details, you can take a look at how the Maven POM file is configured with some plugins to achieve such results.


In the next post I will show in practice as the whole process works, how tests are run and even how to write a new test case. Stay tuned!

1 VOTIYes, Excellent!Yes, Excellent!
Ti è stato utile questo articolo?
From Tirasa's Blog
The place where we share what we do, learn and discover day by day.
Go to blog >