[Q&A Friday] How to run Nuxeo integration tests


Fri 13 July 2012 By Laurent Doguin


How to run Nuxeo integration tests How to run Nuxeo integration tests

Hi all, today we have a question from jadtn. He wants to know how to run the different webdriver tests separately. We have a specific tool to ease WebDriver and Selenium testing: https://github.com/nuxeo/tools-nuxeo-ftest

This project can be seen as a shortcut to use nuxeo-distribution-tools maven plugin functionalities. It's able to build a Nuxeo distribution, start it, run the tests and then stop the server. It supports many different parameters that makes it flexible, easy to configure, especially for databases. You can run your tests on every Database supported by Nuxeo: PostgreSQL, MsSQL, Oracle 10g, Oracle 11g, MySQL. You also have parameters to specify Java's home, Nuxeo home or nuxeo.conf emplacement. We use it for our Continuous Integration jobs on qa.nuxeo.org. Take a look at our multiosdb job for example. It runs tests on a Tomcat Nuxeo server across HSQL, PostgreSQL, MsSQL, Oracle 11g, MySQL on both Linux and Windows.

So if you're planning on building your own application on top of our Platform, you should really look at these tools. But enough with the gibbering, let's get to work :D

I'll take nuxeo-distribution as example. Let's say you want to run all selenium test suite on a tomcat based Nuxeo, you need to type this:

[bash]
mvn verify -f nuxeo-distribution-dm/ftest/selenium/pom.xml -Ptomcat
[/bash]

Where -f is the maven option to specify which pom file to use, -P option is the selected maven profile and verify is a phase that calls all the previous one(validate, compile, test, package, pre-integration-test, integration-test and post-integration-test). So what it does is get the last nuxeo-distribution-tomcat sdk, starts it taking your custom parameters into account (templates, database etc..), run the tests you want and then stop the server.

If you only want to run the first test suite, you can add this parameter:

[bash]
mvn verify -f nuxeo-distribution-dm/ftest/selenium/pom.xml -Ptomcat -Dsuites=suite1
[/bash]

If you only want to run the tests, that you have no need for a distribution download or configuration, and have a server running, you can run the test using the following command:

[bash]
mvn org.nuxeo.build:nuxeo-distribution-tools:integration-test -Dtarget=run-selenium -Dsuites=suite1
[/bash]

If you want more information about available parameters, take a look at the ReadMe in tools-nuxeo-ftest.

All of this was for nuxeo-distribution, if you want to use your own distribution, take a look at our sample project on Github: https://github.com/nuxeo/nuxeo-marketplace-sample. You really want to start any project you are doing by forking nuxeo-marketplace-sample; there is all you need to start: a distribution sample, a marketplace sample, a funkload, selenium and webdriver sample.

See ya Monday :-)


Category: Product & Development
Tagged: Java, Q&A