This document will show how to integrate Selenium, Soapui with Test link. This integration is nothing more than sending the execution result of the SOAPUI test script for Test link.
Prerequisites:
- Install Test link version 1.9
- dbfacade-Testlink-api-client
- Libraries Selenium RC Java
- Install SoapUI 3.6.1
I) Configure Test Link
Step2: Edit the configuration file in Test link
1) Add below two lines in file
custom_config.inc.php.example
$tlCfg-> api -> enabled
$tlCfg-> exec_cfg-> enable_test_automation
2) Rename custom_config.inc.php.example as custom_config.inc.php
Step3: Generate a new key access
After you enable the API access to XML-RPC and report the activation of automation in the configuration file is necessary to generate the key. This key is created by user and that it will allow the Test link identify who is trying to access the XML-RPC services.
TestLinkHomePage--->My Settings--->Account Settings--->ApiInterface Section--->Click on Generate a new key.
II) Configure SOAPUI
Step1:-Install SOAPUI 3.6.1
Software.
Step2: Create a new Project.
Right Click on Projects--->New
soapUI Project.
Step3: Create a Test Suite
Test Suite is a
collection of test cases that are intended to be used to test a
software program to show that it has some specified set of behaviors.
To Create a test Suite, double click on
the Project name, overview of the Project will be displayed. Click on
Test Suites Icon as Shown below
Step 4: Create a Test Case.
Step5:Add Groovy Script to test
case.
III) Preparing Development
Environment (SOAPUI)
Step1:-Add the following jar
files in SOAPUI ext folder.
Path: C:\Program
Files\eviware\soapUI-3.6.1\bin\ext
- dbfacade-Testlink:
- Testlink-client-api-2.0.jar
- all libs
- Testlink-client-api-2.0.jar
- Selenium RC:
- selenium-server.jar
- Selenium-java-client-driver. jar
- selenium-server.jar
Step2: Create new project
(TestLinkSelenium) in Eclipse
Step3: Create new package (test
link).
Step4: Create Class
ResultadoExecution to package (testlink).
Create ResultadoExecution class, which is responsible for sending the result of the script to Test link.
Create ResultadoExecution class, which is responsible for sending the result of the script to Test link.
package testlink;
import
testlink.api.java.client.TestLinkAPIClient;
import
testlink.api.java.client.TestLinkAPIException;
public
class
ResultadoExecution implements
IConstantes
{
public
static
void
reportTestCaseResult1(String TestProject, String TestPlan, String
TestCase, String BuildName, String nota, String resultado) throws
TestLinkAPIException
{
TestLinkAPIClient testlinkAPIClient = new
TestLinkAPIClient(DEVKEY,
URL);
testlinkAPIClient.reportTestCaseResult(TestProject, TestPlan,
TestCase, BuildName, nota, resultado);
}
}
Step5: Create Interface
Iconstantes to package (testlink).
Create an interface with the data
necessary to send the data to the Testlink, which are the parameters
that were described above.
package testlink;
public interface
IConstantes {
final String
DEVKEY
= "7c0893a8c63d2599074a308de09ad75b";
final
String URL
= "http://localhost:82/testlink/lib/api/xmlrpc.php";
final
String PROJECT
= "SeleniumIntegrationWithTestlink";
final String
PLAN
= "LCLT001-IntegratingSelenium";
final String
BUILD
= "integarationbuild1";
final String
TestCase1
= "Limsearch";
final String
TestCase2
= "Searchbyemail";
}
Here DEVKEY =generated API KEY
PROJECT= Project name in
Testlink.
PLAN=TestPlan Name
BUILD=Build Name
TestCase1=TestCaseName
(Limsearch)
Step6: Create jar file
(soapui.jar)for class ResultadoExecution and interface Iconstantes
.This jar file will be use in Soapui.
Step7: Add created jar file
(soapui.jar) to ext folder of soapui.
Path: C:\Program
Files\eviware\soapUI-3.6.1\bin\ext
Step8: Add the SourceCode to
Groovy Script in Soapui.
import
com.thoughtworks.selenium.*;
import
java.util.regex.Pattern;
import
testlink.api.java.client.TestLinkAPIResults;
import
testlink.api.java.client.TestLinkAPIClient;
import
testlink.api.java.client.TestLinkAPIException;
import
testlink.*; //import ResultadoExecution and IConstantes
public final
class Emailsearch implements IConstantes {
private static
Emailsearch instance;
public Selenium
selenium;
private
Emailsearch (String host, int port, String browserType, String url)
{
this.selenium= new DefaultSelenium(host, port, browserType, url);
this.selenium.start ();
this.selenium.open (url);
String
resultado = null;
String nota =
null;
try {
selenium.open ("/");
selenium.click ("link=Login");
selenium.waitForPageToLoad ("60000");
selenium.type ("login", "bala");
selenium.type ("password", "krishna");
selenium.click ("Submit");
selenium.waitForPageToLoad ("30000");
selenium.click ("link=Search Member");
selenium.waitForPageToLoad ("30000");
selenium.type ("email", "sample@cil.com");
selenium.click ("//input [@type='submit']");
selenium.waitForPageToLoad ("30000");
selenium.click ("link=Logout");
selenium.waitForPageToLoad ("30000");
selenium.close ();
selenium.stop ();
resultado =
TestLinkAPIResults.TEST_PASSED
}
catch
(Exception e) {
resultado = TestLinkAPIResults.TEST_FAILED;
nota = e.getMessage ();
e.printStackTrace ();
}
finally {
ResultadoExecution.reportTestCaseResult1 (PROJET, PLAN, TestCase1,
BUILD, nota, resultado);
}
}
public static
Emailsearch getInstance (String host, int port, String browserType,
String url)
{
instance =
new Emailsearch (host, port, browserType, url);
return
instance;
}
}
Emailsearch.getInstance
("172.16.2.212",
4444,"*iexplore","http://www.lowcostloadtest.com");
Step9: Start SeleniumServer.jar
Step10: Launch TestRunner in SoapUi.
Step11:Click on Launch. Selenium
testcase will be executed in iexplore.
Step12:After completing the execution
test Case Results will be updated in Test Link.
This comment has been removed by the author.
ReplyDeleteHello bala
ReplyDeletePls let know if this solution is worki g
Hello bala
ReplyDeletePls let know if this solution is worki g
Hi
ReplyDeletei tried to automate integration with jenkins, but send me an error message in jenkins:
çpackage testlink.api.java.client
Someone can help me?