The purpose of this page is to explain how to create a Jenkins job that will run an automated test project an save test results in Testlink.
Three things are required :
We start by configuring Testlink. The goal is to add some informations and configuration that will be used by Jenkins. We consider that we starts with an already existing Testlink project that contains the tests that are automated in the java project.
We add a custom field to every test scenario. Those fields will be used to bind one test to one java class.
Select the right Project ("Test Management") and Test Plan ("System testing (Automated)"). From the main page, go to the "Define custom fields" section at the left of the screen". Click on "Create". Fill in informations :
Go to the "Test Specifications" section. The list of every test case is displayed. For every test case for whom you have an automated test :
Teslink has a special user which corresponds to the automated tester. He is called "Jenkins tester". To identify as this user, Jenkins uses its developper key. Currently it is "3f216bbb9926913a3373274d33c04242". If the key changed, it is accessible in the "My setting" menu when logged-in as the Jenkins tester user in Testlink.
At the home page of testlink, with an admin account, click on "Test project management". Clik on our project ("Test Management") and make sure that "Enable Test Automation (API key)" and "Enable inventory" are properly checked.
We are now done with TestLink. Every test case is considered as automated and is able to tell which java class should run it.
Click on "Administrate Jenkins" > "Plugins Management" > "Available" tab > at the "TestLink Plugin" line, check the box. At the bottom of the page, click on "Download now and install after restart". Wait a few seconds.
Go back to jenkins' homepage. Click on "Administrate Jenkins" > "Configure System".
At the TestLink section, fill in informations :
Installing the Extensible Choice plugin
Click on "Administrate Jenkins" > "Plugins Management" > "Available" tab > at the "Extensible Choice" line, check the box. At the bottom of the page, click on "Download now and install after restart". Wait a few seconds.
Installing the Xvfb plugin
Click on "Administrate Jenkins" > "Plugins Management" > "Available" tab > at the "Xvfb" line, check the box. At the bottom of the page, click on "Download now and install after restart". Wait a few seconds.
This plugin is used to create a temporaty virtual frame buffer for the job.
Installing the SSH plugin
Click on "Administrate Jenkins" > "Plugins Management" > "Available" tab > at the "SSH Plugin" line, check the box. At the bottom of the page, click on "Download now and install after restart". Wait a few seconds.
Go back to jenkins' homepage. Click on "Administrate Jenkins" > "Configure System".
At the "SSH Remote Hosts" section, Fill in information for the ssh access to the server that host the tested Gazelle-TM.
This way jenkins can perform some initialization commands in the Gazelle-TM server.
Go to "Manage Jenkins" menu then click on "Configure Jenkins".
Then scroll to :
Extensible Choice: Available Choice Providers
|
In this section, make sure that Global Choice Parameter is ticked. Then click on "Add New Choice List" button.
Fill-in the new container like this :
Go back to Jenkins' home page. Click on "New Job", select "Free Style Project" and fill-in the name ("Gazelle-TM-GuiTesting").
In "source code management" select how your test project will be fetched by Jenkins. If it is on a SVN repository, select "Subversion" and fill-in repository informations. If the project is locally stored select "none".
The currend location is : "https://scm.gforge.inria.fr/anonscm/svn/gazelle/Maven/gazelle-gui-testing/Automated-Test-testNG/branches/idr_testing"
In the "General" section, tick "This build has parameters" then select "Add parameter" and chose "Extensible Choice". Fill-in informations :
Click another time on "Add parameter" and chose "Extensible Choice" again. Fill-in like this :
Click another time on "Add parameter" and chose "Extensible Choice" again. Fill-in like this :
In the "build" section, select "Add a step" and chose "Invoke TestLink". Fill-in informations :
In the "Test execution subsection", for "single build test", select "Add action". Then fill-in :
In the "Result seeking strategy" select Add Strategy > TestNG class name. Fill-in :
Click on save at the bottom of the page
Go back to Jenkins' home page. Click on "New Job", select "Free Style Project" and fill-in the name ("Gazelle-Deployment").
In the "build" section, select "Add a step" and choose "Execute shell script on remote host using ssh". Fill-in informations :
cd /home/gazelle/unit_tests_selenium/
./restore_database_J7.sh
In the "Actions after build" section, select "Add a step" and choose "Trigger parametrized build on other projects".
Fiil-in informations :
Click on save at the bottom of the page
The jenkins jobs are now completely configured and should work properly.
A sum up of an execution would be :