Configuration of Jenkins Docker for Gauge Project to Run Test Automation

Doğacan Toka
Apr 17 · 5 min read

Pre-requests

Before reviewing this study, please make sure that you have reviewed and applied the previous study.

Hello, previously we have completed the installation of our CI/CD tools. Let’s see how to use these tools in practice.

First of all, it is better to aware that some packages and plugins must be installed. Besides, we are working on a docker container so some operations we are going to establish and maintain sound a little bit bizarre.

Step 1 — Inside Jenkins Container

Before proceeding, please make sure your Dockerfile file has been built successfully and Maven is installed. Now, if you are inside your Jenkins container, you can start.

  1. Install Gauge Framework

You can run the following which is recommended by Gauge

This output would appear on your console :

If you type gauge –v command :

As you can see, there are not any gauge plugins installed. You can run the below commands to install some of them :

Type gauge –v command to make sure you have installed Gauge and its plugins successfully.

2. Install Google Chrome Package

We need now a browser to run our tests. In this work, we have run our test on Google Chrome.

If you have some troubles, I highly recommend you to visit the websites :

Step 2— Jenkins Manage Plugins

You should install the necessary plugins on the Jenkins Manage Plugin page.

  • Maven Integration
  • Gitlab
  • Sonarqube scanner
  • Ansicolor (optional)

Step 3— Jenkins General Configuration

  1. Add Sonarqube Service

Let’s start with creating a new token and save it to use later :

Next, add credentials for Sonar. The secret will be filled with API Token you have just created. Others are optional.

Now, back to the Jenkins Manage Jenkins / Configure System / Sonarqube Server :

The URL area should be filled as <yourIP>/sonarqube.

2. Add Gitlab Credential

Add your GitLab credentials as shown in the figure :

3. Checking Installation Configurations

In the Global Tool Settings you should check and configure the installations properly :

JAVA INSTALLATION

MAVEN INSTALLATION

SONARQUBE SCANNER : (You can install externally if you want.)

Finally, click on the apply and then the save button.

Step 4— Create a Project In Sonarqube

  1. Click to Create a Project.
  2. Type a project key as you want.
  3. You can either create a new token or use existing tokens
  4. Select Java for programming language and Maven for build technology.
  5. In the end, you will see a piece of code. Please keep it in somewhere. We are going to use it later.

Step 5 — Create a Job in Jenkins

  1. Click on Create a New Job button.
  2. Give a name to your project and select Free Style Project.
  3. In the Source Code Management, select Git and fill out the git repo URL, branch and select the proper credential.

4. Build Environment (Color ANSI is optional.)

5. Add Invoke Top Level Maven Target build step:

This step could also have been done with a shell script. I want to show you that we can also use this build step to implement Maven commands.

6. Add Execute Sonarqube Scanner build step and fill out according to your Sonarqube project information.

Note that you should fill the first three lines according to your sonar project.

7. Add Execute Shell and add the following code.

After you have done the steps above, just click on apply and save. Afterward, you can start building your job.

SOME IMPORTANT NOTES

  • Make sure your environment settings (version of Gauge and its plugin are matching with your pom.xml file)
  • This only works with HEADLESS mode. So make sure that you add your chrome driver to the headless mode. Otherwise, you will probably get an error.
  • I highly recommend you to use WebDriver Manager.

RESULT

After your build is finished , you would get an output like this :

Sonarqube Analysis Finished
Starting run the Gauge Project for Oobeya Login Specification
After the 2 Scenario run is finished, the result.

Thank you for your time.

Testinium Tech

Testinium Tech

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store