Automate Testlink Test Case Result Using Selenium

This article is about, Run Test cases with automation scripts in test link. It is necessary that you had worked on selenium before. After wards only you will understand this still try to explore from below information.

There are some important points and Preconditions for this. You need to install Java first. Then install Eclipse. Give proper Path in environment variable for Java and Eclips.

Moving to Next, Install Junit 4.11 jar , Selenium Jar and Test Link client API jar.

Now, Log in with Test link and select a test project from home page. Go to My settings and Verify the
API Interface. From here you can create your API key for a Project. Create New API Key and Note down key in a text file.

After Generate a Key, you need to update test case execution Type from 'Manual' to 'Automated'.

After this step you need to note down the Test Project Name, Test Plan Name, Test Case Name, Build Name.

Then open eclips. Create a new java project for Test case execution in test link. Create a Package for this project.

Now you Add external jars which we have already download. Do right click on project then click on 'Configure Build Path' and select Libraries. Here you can see a button as 'Add External Jars'. Click on it and Add 4 jars.
  • Junit – 4.11.
  • Selenium – standalone server jar.
  • Selenium – Java jar & all libs jar.
  • Test Link Client API jars. Download.
Click on 'OK' button from screen so this all jar will be added for your project. Now convert your project in TestNG and write down the below code in the Eclipse IDE.

package TestCaseExecution;

import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class TestLink
 public static WebDriver driver;
 //Enter your project API key here. 
 public static String DEVKEY="040d169f3f1a2b38ced46c37d073a1c4"; 
 //Enter your Test Link URL here
 public static String URL= "";
 //Enter your Test Project Name here 
 String testProject="Test Project1";
 //Enter your Test Plan here
 String testPlan="Test Plan";
 //Enter your Test build here
 String build="Test Build";


public void setUp() throws Exception
  //Enter the path for your browser exe file here
  driver = new ChromeDriver();


public void Test()throws Exception

 String result = "";
 String exception = "";

  //Enter your applicaton URL.
  //Enter your user name.
  driver.findElement(By.xpath("//input[@id='txtUser']")).sendKeys("Your UserName");
  //Enter your pswd.
  driver.findElement(By.xpath("//input[@id='txtPass']")).sendKeys("Your pswd");
  //Find Xpath of your click button and enter here

  result= TestLinkAPIResults.TEST_PASSED;
  //Enter your test case ID here
  updateTestLinkResult("Test case ID", null, result); 

 catch(Exception e)
  result = TestLinkAPIResults.TEST_FAILED;
          exception = e.getMessage();
          updateTestLinkResult("Test case ID", exception, result);

public void updateTestLinkResult(String testCase, String exception, String result)    throws TestLinkAPIException
     TestLinkAPIClient testlinkAPIClient = new TestLinkAPIClient(DEVKEY,URL);
     testlinkAPIClient.reportTestCaseResult(testProject, testPlan, testCase, build, exception, result);


public void close()

This is the scrip for run test case automatically in test link. You need to Run the script from eclips and verify the result.

Now we will understand what we have done above. Gmail Login test case is passed due to this script. First this Login test case has 'Not Run' status in testlink. After running script it will have status as 'Passed' if successful Login is done by your valid user name and pswd.

Be care full while Enter your Test Project Name, Test Plan Name, Test Build Name, Test URL and Test case ID. If you made any mistake for this field then script will not run successfully.



  1. I am getting below error: The call to the xml-rpc client failed.
    at Testlink.updateTestLinkResult(
    at Testlink.Test(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.testng.internal.MethodInvocationHelper.invokeMethod(
    at org.testng.internal.Invoker.invokeMethod(
    at org.testng.internal.Invoker.invokeTestMethod(
    at org.testng.internal.Invoker.invokeTestMethods(
    at org.testng.internal.TestMethodWorker.invokeTestMethods(
    at org.testng.TestRunner.privateRun(
    at org.testng.SuiteRunner.runTest(
    at org.testng.SuiteRunner.runSequentially(
    at org.testng.SuiteRunner.privateRun(
    at org.testng.SuiteRunnerWorker.runSuite(
    at org.testng.TestNG.runSuitesSequentially(
    at org.testng.TestNG.runSuitesLocally(
    at org.testng.remote.RemoteTestNG.initAndRun(
    at org.testng.remote.RemoteTestNG.main(
    Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse servers response: Content is not allowed in prolog.
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(
    at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(
    at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(
    at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(
    at org.apache.xmlrpc.client.XmlRpcClient.execute(
    at org.apache.xmlrpc.client.XmlRpcClient.execute(
    at org.apache.xmlrpc.client.XmlRpcClient.execute(
    ... 31 more

  2. Issue resolved after edit php.ini file and set always_populate_raw_post_data = -1

  3. Hi,

    I am getting below error: The test case identifier null was not found and the test case 485 could not be accessed to report a test result to test plan UIAutomatoion.

  4. I added the testlink-api jar file in eclipse but when Iam running the script it still giving the error:java.lang.NoClassDefFoundError: org/apache/xmlrpc/client/XmlRpcClientConfig