So how hard would be for me to run the integration tests on my machine, I asked my colleague.
This is very hard, he said, you will need at least a couple of days to configure and install everything.
This post will present the solution I put in place for a fully-automated platform for integration tests, using maven and the Robot Framework. Once we’re done, we could answer the above question something like this:
It’s easy, you should be able to do that in couple of minutes, everything is automated.
The big picture
I will not get into details about the business application we are testing. It is a server application which provides some services for other applications using some communication protocol (sockets, for instance). My application needs itself to connect to some third-party applications to use their services. We suppose we already have a java library which allows us to write java code to communicate with our application.
Lets first see the components involved in the platform
- The application under test. This is a java application using maven as the build tool.
- A set of applications (we call them third party applications although, in my case, they are developed by our teams) providing services to the application under test. These applications need to be configured and started in order for the application under test to be able to connect to them and use the services.
- our Nexus Repository Manager – this is where we deploy our artifacts. Applications needed by the application under test are deployed here as artifacts.
- SVN repository – we have an SVN repository for the application under test. The repo contains a folder (src/test/ressources) where we keep the configuration files for all the applications involved in the tests, as well as the test files themselves.
Goals of our testing platform
- Anybody can run the tests on his machine (no prerequisites, no manual download or configuration of any third party component, 2 minutes to set up and run the tests)
- Anybody can write a test (We mean anybody)
- Tests are versioned with the application under test (no need to sync tests and the application under test, I can test the development version on my machine )
These are the steps that we will need to perform
- prepare-package phase
- prepare configuration files for all applications involved in the tests
- package phase
- package application under test
- download third-party applications artifacts
- pre-integration-test phase
- configure and start third party applications
- configure and start application under test
- integration test phase
- run robot tests
- verify results
- post-integration-test phase
- stop all applications
And this is the file structure of my project (commited on SVN):
- src/main/java – java code of my application
- src/test/java – java code of the robot kewords
- src/test/ressources/config – configuration files for third-party applications
- src/test/ressources/robotframework – robot test files
My following posts will show how we build this automatic test-platform step by step.