Step by Step Procedure for integrating Selenium with TestLink

 In Testing

This blog outlines the Step by Step procedure for integrating Selenuim, Web Automation Framework with TestLink, Test Management Tool for updating test case status automatically.


Test-link is most widely used web based open source test management tool. Testlink provides the following features

  • Synchronizes requirements specification and test specification together.
  • Allows to create project and document test cases.
  • Allows to create multiple accounts for different roles and supports Role based access control.
  • Supports both automated and manual execution of Test cases.
  • Allows to generate Test Plan and Test Report in a fraction of the time and supports test reports in various formats like Excel, MS word, and HTML formats.


WebDriver is a web automation framework that allows you to execute your tests against different browsers like Firefox, Internet explorer, Google Chrome, etc.
WebDriver also enables you to use different programming language in creating your test scripts. Following programming languages are supported by WebDriver.
Java, .Net, PHP, Python, Perl and Ruby.

Here are the Step by Step procedure for integrating Selenium Webdriver with TestLink

Step-1: Install Test Link

Install TestLink by following the instructions available in Click Here .

Step-2: Enable Automation in TestLink

Automation need to be enabled for integrating with Selenium.
To enable API Key: Go to Project -> Open your project -> Select “Enable Test Automation” / “API Key”.

Step-3: Generate API Key

Go to My settings -> Click on “Generate a new key”
Then you should create Test Project, Test Plan, Build and Test suite. You can find the user guide in above provided link.
API Key is used to communication between webdriver code and testlink.

Step-4: Download TestLink Client API Jar:

Download and include TestLink API Jar file in your project build path library. The following files need to be included

  • testlink-api-client-2.0.jar
  • xmlrpc-common-3.1.jar
  • xmlrpc-client-3.1.jar
  • ws-commons-util-1.0.2.jar

The parent file which contains all these files can be downloaded by clicking the link Click Here (download the latest).

Step-5: Configure the files in Selenium automation project

Copy and paste the files into your project. Ex: The picture below shows the project created in Eclipse using Java. You can also use any editing tool and any language like C#.

Step-6: Develop code to communicate to Testlink from Selenium

Here is the code snippet

package Gmail;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
public class LoginTest {
public static WebDriver dr;
public static String DEV_KEY = "d6913d5059032c0b815458c51dd56150"; //Your API 
public static String SERVER_URL = "http://localhost/testlink/site/index.php"; //your testlink server url
public static String PROJECT_NAME = "MailTest"; 
public static String PLAN_NAME = "Testing";
public static String BUILD_NAME = "TestBuild";
public void TestOne() throws Exception
String result = "";
String exception = null;
dr = new FirefoxDriver();
result = TestLinkAPIResults.TEST_PASSED;
updateTestLinkResult("Test-1", null, result);
catch (Exception e){
result = TestLinkAPIResults.TEST_FAILED;
exception = e.getMessage();
updateTestLinkResult("Test-1", exception, result);
try {
dr.findElement("Email")).sendKeys("your gmail login id");
result = TestLinkAPIResults.TEST_PASSED;
updateTestLinkResult("Test-2", null, result);
catch (Exception e) {
result = TestLinkAPIResults.TEST_FAILED;
exception = e.getMessage();
updateTestLinkResult("Test-2", exception, result);
private void updateTestLinkResult(String testCase, String exception, String result) throws TestLinkAPIException{
TestLinkAPIClient testlinkAPIClient = new TestLinkAPIClient(DEV_KEY, SERVER_URL);
testlinkAPIClient.reportTestCaseResult(PROJECT_NAME, PLAN_NAME, testCase, BUILD_NAME, exception, result);

Step-6: Execute Selenium test and update Test result in TestLink

Once you execute the script it updates the result for the particular test case in TestLink. The screenshot below shows the Testcase status updated from Selenium.

Typical Issues:

If your code throws an error like “ The call to the xml-rpc client failed.”
Change the server url to http://localhost/testlink/lib/api/xmlrpc/v1/xmlrpc.php

Now run your test script again. ☺ which will automatically update the test case status in Testlink

Recent Posts
Showing 2 comments
  • Prashant Rathi

    If you found the error: TestLink XML-RPC The call to the xml-rpc client failed.

    Try below:
    Issue resolved by edit php.ini file and set always_populate_raw_post_data = -1

    • Ganesh

      That’s great, thanks for sharing.

Leave a Comment

Start typing and press Enter to search