Saturday, August 25, 2018

Automate Testlink Exam Illustration Lawsuit Using Selenium

| Saturday, August 25, 2018
This article is about, Run Test cases amongst automation scripts inward examination link. It is necessary that you lot had worked on selenium before. After wards only you lot volition empathize this yet endeavour to explore from below information.

There are some of import points as well as Preconditions for this. You require to install Java first. Then install Eclipse. Give proper Path inward surroundings variable for Java as well as Eclips.

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

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


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


After this pace you lot require to banker's complaint 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 inward examination link. Create a Package for this project.

Now you lot Add external jars which nosotros induce got already download. Do correct click on projection as well as thus click on 'Configure Build Path' as well as select Libraries. Here you lot tin privy run across a push clit every bit 'Add External Jars'. Click on it as well as Add iv jars.
  • Junit – 4.11.
  • Selenium – standalone server jar.
  • Selenium – Java jounce & all libs jar.
  • Test Link Client API jars. Download.
Click on 'OK' push clit from covert thus this all jounce volition hold upward added for your project. Now convert your projection inward TestNG as well as write downwards the below code inward 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;  populace degree TestLink {  populace static WebDriver driver;  //Enter your projection API substitution here.   populace static String DEVKEY="040d169f3f1a2b38ced46c37d073a1c4";      //Enter your Test Link URL here  populace 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  populace 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  populace void Test()throws Exception  {  String number = "";  String exception = "";   endeavour  {   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 clit as well as travel into 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)  {   number = TestLinkAPIResults.TEST_FAILED;           exception = e.getMessage();           updateTestLinkResult("Test representative ID", exception, result);  } }  populace 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  populace void close() {  driver.quit(); } }

This is the scrip for run examination representative automatically inward examination link. You require to Run the script from eclips as well as verify the result.

Now nosotros volition empathize what nosotros induce got done above. Gmail Login examination representative is passed due to this script. First this Login examination representative has 'Not Run' status inward testlink. After running script it volition induce got status every bit 'Passed' if successful Login is done past times your valid user lift as well as pswd.

Be tending sum piece Enter your Test Project Name, Test Plan Name, Test Build Name, Test URL as well as Test representative ID. If you lot made whatever fault for this acre as well as thus script volition non run successfully.

<< PREVIOUS || NEXT >>

Related Posts