How to Update TestLink Test Case Execution Status Remotely Through Selenium – Tutorial #3

Updating TestLink Test Case Execution Status Remotely Through Selenium WebDriver Using TestLink API

In the first two TestLink tutorials (part 1 and part 2) we learned TestLink installation, creating a test project, test plan, test cases, requirements management, manual execution of test cases, and generating test reports.

Today, we will learn one advanced and important feature of TestLink i.e. updating test case execution status through Selenium WebDriver code using TestLink API. We will also provide the exact Selenium code that you can use for this API call.

_Update TestLink Test Case Execution

With this feature, you don’t have to log in to TestLink each time to update the test case execution status. You can do it automatically using TestLink API. This will save your lot of manual execution time.

To demonstrate this feature we are using Selenium WebDriver and updating the test case status along with test note in TestLink.

Let’s have a deep look at – how to update test case execution status remotely through Selenium WebDriver code and TestLink API through XML-RPC call.


  • All the steps explained in TestLink tutorial #1 should be done.
  • You are using Selenium for test automation on your project.
  • Test cases that are automated using Selenium can be updated in TestLink through Selenium code.


  • You can download java from here.
  • Double click on the .exe file and install java on your system.


  • Download Eclipse for windows from here.
  • It will be downloaded as a zip package, extract and place it on your local drive.

Selenium Library Jars
Download selenium-java jar and selenium-standalone jar from here.

Download Junit 4.11 jar from here.

TestLink Client API jars
Download Test Client API jars from here.

Enabling TestLink API

For automated test case execution, TestLink API configuration should be enabled in the configuration file.

To Enable API to follow these steps:

Step #1) (Stop Apache service)
TestLink has already deployed in Apache. Before doing any modifications in configuration file Apache should be stopped.

To do that, open Control Panel -> System and Security -> Administrative Tools.
Double click on the “services” icon.

TestLink img1

Click on Apache 2.4 service and click on the “stop the service” link appearing on the left side.
It will stop the Apache service.

Step #2) (Enable API in TestLink Configuration file)
Open the TestLink folder inside htdocs folder and open file in edit mode.
Change the following line to “TRUE”.

 /* [API] */
/** XML-RPC API availability - do less than promised 
FALSE => user are not able to generate and set 
his/her API key. XML-RPC server do not check this 
config in order to answer or not a call.

$tlCfg->api->enabled = TRUE; 

Save and close the file.

Step #3) (Start Apache service)
Open Apache service as described in Step 1 and start it.

Generating API Key

TestLink provides an API key for each user which is essential for updating Test case execution status in an automated way.

The API key can be generated through simple steps as explained in below steps:

Step #1) 
Open TestLink URL in your browser and log in with your user credentials.

Step #2)
Open the “My Settings” link on the TestLink desktop page.

TestLink img2

Step #3)
Click on the “Generate a New Key” button in the API Interface section.

TestLink img3

A new key will be generated and displayed on the page.

TestLink img4

Changing Execution Mode

To update a Test case execution status through API, its execution type should be “Automated”.

Changing the test case execution type to Automated:

Note: If you are following this remote status update practice you can update the execution type to Automated while creating the test cases itself.

Open a Test case and click on the “settings” icon appearing on the right-side panel. It will display a list of operations. Click on the “Edit” button.

TestLink img5

Change Execution Type to “Automated”.

TestLink img6

Click on the “Save” button.

Note down the Test case name, Test project name, Test plan name, and the build name. We will need these details in our Selenium code.

In our example,
Test Project Name: Gmail
Test Plan Name: SampleTestPlan
Test Case Name: GmailLogin1
Build Name: SampleBuild

Writing Selenium Code

Open Eclipse, and create a Java project as shown in the below figure.

TestLink img7

Right-click on the Project, go to Build Path -> Configure build path, switch to the “Libraries” tab and click on the “Add External Jars” button.

Add the following jars in the build path

  • Junit 4.11 jar
  • Selenium-standalone server jar
  • Selenium – java jar & all libs (Library folder) jar
  • TestLink Client API jar & all lib (Library folder) jar

TestLink img8

Click the “OK” button. All jars will be added to the project build path.

Create a package inside the src directory of the java project as shown below:

TestLink img9

Create a class inside the package with the name “AutomatedUpdateExample”.

Copy the following code into that class:

 package com.test;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class AutomatedUpdateExample {

public static String DEVKEY="2f404203b306bd8dd811a7f824c194d0";
public static String URL="http://localhost/testlink/lib/api/xmlrpc/v1/xmlrpc.php";

public static void reportResult(String TestProject,String TestPlan,String Testcase,String Build,String Notes,String Result) throws TestLinkAPIException{
TestLinkAPIClient api=new TestLinkAPIClient(DEVKEY, URL);
api.reportTestCaseResult(TestProject, TestPlan, Testcase, Build, Notes, Result);

public void Test1()throws Exception
AutomatedUpdateExample a=new AutomatedUpdateExample();
WebDriver driver=new FirefoxDriver();
WebDriverWait wait=new WebDriverWait(driver, 600);
String testProject="Gmail";
String testPlan="SampleTestPlan";
String testCase="GmailLogin1";
String build="SampleBuild";
String notes=null;
String result=null;
result= TestLinkAPIResults.TEST_PASSED;
notes="Executed successfully";
catch(Exception e){
notes="Execution failed";

a.reportResult(testProject, testPlan, testCase, build, notes, result);

[Note: update Test project, Test plan, Test case and Build name in above code as per your project details]

Save the file.

Executing Selenium Code

Depending on the execution of the test in Selenium, TestLink test case status will be updated as either “Passed” or “Failed”.

If the code executed successfully without any exceptions then test case status will be updated as “Passed”. In case of any exceptions test case status will be updated as “Failed”.

To execute code, just right click on the file and select Run As -> Junit Test. It will start executing the test.

TestLink img10

Now open TestLink in your browser and see the execution status for the test case. It should be updated.

Before Execution

TestLink img11

After Execution

TestLink img12


I hope we have clearly explained how to update the TestLink test case execution status automatically using TestLink API.

The testers can easily update test case execution status directly in TestLink without having to log in. This will surely help you save your precious time and money. :)

This again proves that TestLink is a good open-source Test Management Tool, which can be used by manual testers as well as automation experts.

With this, we are concluding our TestLink tutorial series. Feel free to post your queries in comments.

Recommended Reading

54 thoughts on “How to Update TestLink Test Case Execution Status Remotely Through Selenium – Tutorial #3”

  1. Hi
    How To Update TestLink Test Case Execution Status Remotely using cypress instead of selenium?

  2. Hi ! can you help me ! How To Update TestLink Test Case Execution Status Remotely using cypress instead of selenium?

  3. Hi!
    I’m trying to get a result by step, actually, I have the script to execute and pass or fail the complete test case, can you please help me? Thanks!


Leave a Comment