user2908112
user2908112

Reputation: 535

Integration tests in Jenkins

I want to do some integrations tests with Selenium on my Java web application. I have set up Jenkins to build currently using Ant script.

As I understand it, the web application must be built, packaged and deployed to a running server before it can be tested with Selenium webdriver (on localhost). When I do this locally it works fine. But on my Jenkins machine I need to start another server other then the one Jenkins run on in order to deploy the war file there and then run the tests right? The problem is that deployment is a post-build action and I can't run any tests after that, or can I?

Upvotes: 3

Views: 4813

Answers (2)

Rogério Peixoto
Rogério Peixoto

Reputation: 2247

Why don't use Docker for providing building, deploying and testing environments?

It will provide the kind of isolation that you require for building and testing your web app inside your Jenkins server.

You can define different environments to match your project's dependencies using Dockerfiles and building your own container images. Think of containers as very light weight virtual machines. In your case, for building and testing your web app I imagine you would need at least a machine with JDK and Selenium Webdriver installed.

There are a bunch of images available at the official Docker container registry, Dockerhub which you could use instead of building your own.

For a nice white paper on getting started using continuous integration with Docker and Jenkins go here

Upvotes: 3

vaibhavnd
vaibhavnd

Reputation: 301

you can run definitely. You can use different jobs for each step. pre-build, build, postbuild. Jenkins is very flexible tool. You need to not worry about doing all steps in a single job. I suggest you write one job for deployment and depending on it's success you can trigger build on another project i.e. run your sanity tests job.

Upvotes: 1

Related Questions