Automate Testlink Test Case Result Using Selenium

This article is about, Run Test cases amongst automation scripts inwards examination link. It is necessary that you lot had worked on selenium before. After wards only you lot volition sympathise this all the same endeavor to explore from below information.

There are some of import points in addition to Preconditions for this. You necessitate to install Java first. Then install Eclipse. Give proper Path inwards surroundings variable for Java in addition to Eclips.

Moving to Next, Install Junit 4.11 jounce , Selenium Jar in addition to Test Link customer API jar.

Now, Log inwards amongst Test link in addition to select a examination projection from dwelling page. Go to My settings in addition to Verify the
API Interface. From hither you lot tin practise your API fundamental for a Project. Create New API Key in addition to Note downwards fundamental inwards a text file.


After Generate a Key, you lot necessitate to update examination representative execution Type from 'Manual' to 'Automated'.


After this footstep you lot necessitate to authorities notation downwards the Test Project Name, Test Plan Name, Test Case Name, Build Name.

Then opened upward eclips. Create a novel coffee projection for Test representative execution inwards examination link. Create a Package for this project.

Now you lot Add external jars which nosotros cause got already download. Do correct click on projection in addition to then click on 'Configure Build Path' in addition to select Libraries. Here you lot tin run across a push every bit 'Add External Jars'. Click on it in addition to Add four jars.
  • Junit – 4.11.
  • Selenium – standalone server jar.
  • Selenium – Java jounce & all libs jar.
  • Test Link Client API jars. Download.
Click on 'OK' push from covert thus this all jounce volition endure added for your project. Now convert your projection inwards TestNG in addition to write downwards the below code inwards 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.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import testlink.api.java.client.TestLinkAPIClient; import testlink.api.java.client.TestLinkAPIException; import testlink.api.java.client.TestLinkAPIResults;  world bird TestLink {  world static WebDriver driver;  //Enter your projection API fundamental here.   world static String DEVKEY="040d169f3f1a2b38ced46c37d073a1c4";      //Enter your Test Link URL here  world static String URL= "www.testlink.com";    //Enter your Test Project Name hither   String testProject="Test Project1";    //Enter your Test Plan here  String testPlan="Test Plan";    //Enter your Test construct here  String build="Test Build";    @BeforeSuite  world void setUp() throws Exception  {    //Enter the path for your browser exe file here   System.setProperty("webdriver.chrome.driver","D:\\chromedriver.exe");   driver = novel ChromeDriver();  }  @Test  world void Test()throws Exception  {  String outcome = "";  String exception = "";   endeavor  {   driver.manage().window().maximize();   //Enter your applicaton URL.   driver.get("http://gmail.com");    //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 push in addition to move inwards here   driver.findElement(By.xpath("//input[@id='btnLogin']")).click();   driver.switchTo().defaultContent();    result= TestLinkAPIResults.TEST_PASSED;   //Enter your examination representative ID here   updateTestLinkResult("Test representative ID", null, result);      }   catch(Exception e)  {   outcome = TestLinkAPIResults.TEST_FAILED;           exception = e.getMessage();           updateTestLinkResult("Test representative ID", exception, result);  } }  world void updateTestLinkResult(String testCase, String exception, String result)    throws TestLinkAPIException {      TestLinkAPIClient testlinkAPIClient = novel TestLinkAPIClient(DEVKEY,URL);      testlinkAPIClient.reportTestCaseResult(testProject, testPlan, testCase, build, exception, result); }  @AfterSuite  world void close() {  driver.quit(); } }

This is the scrip for run examination representative automatically inwards examination link. You necessitate to Run the script from eclips in addition to verify the result.

Now nosotros volition sympathise what nosotros cause got done above. Gmail Login examination representative is passed due to this script. First this Login examination representative has 'Not Run' status inwards testlink. After running script it volition cause got status every bit 'Passed' if successful Login is done yesteryear your valid user cite in addition to pswd.

Be tending sum spell Enter your Test Project Name, Test Plan Name, Test Build Name, Test URL in addition to Test representative ID. If you lot made whatever fault for this champaign in addition to then script volition non run successfully.

<< PREVIOUS || NEXT >>

More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post