2014-03-07 136 views
0

是否有人可以解釋如何鏈接webdriver腳本[在eclipse中編寫的測試]來測試鏈接測試並相應地更新結果?如何使用Selenium webdriver在Testlink中執行測試用例

比如我的測試看起來像這樣在我的webdriver的測試計劃[一類擁有所有我的測試]

@Test 
testA 
{ 
} 

@Test 
testB 
{ 
} 
@Test 
testC 
{ 
} 

我在種皮,TESTB,TESTC我的測試鏈接數據庫中定義相應的測試用例。

當我運行腳本時,測試鏈接數據庫中的測試需要根據通過/失敗標準進行相應更新。

的ENV是從我的測試中使用是

eclipse [for developing  webdriver  scripts] 
selenium 2.0 
testlink 
Testng 
1234 

回答

0

,如果你使用的是Java開發您的webdriver腳本可以使用teslink Java API和用TestNG更新測試用例狀態listeners..basically您需要有Testng的聽衆將會與testlink api聯繫更新測試用例的狀態。如果你不知道TestNG的聽衆here是TestListenerAdapter

的Java API的鏈接
0

按照以下提到的方法來更新測試環節測試結果:

  • link
  • 下載測試環節罐子在測試鏈接中,從我的設置>個人API訪問密鑰獲取DEV_KEY
  • 使用DEV_KEY和SERVER_URL創建TestLinkAPIClient的實例並使用Project N報告測試用例結果ame,測試計劃名稱,測試用例,構建和結果。

參考示例代碼的詳細信息:

 // Substitute your Dev Key Here 
    public final String DEV_KEY = "2b907a29e8895c78d999dce4d2ggg0cd"; 

    // Substitute your Server URL Here 
    public final String SERVER_URL = "http://localhost/testlink/lib/api/xmlrpc/v1/xmlrpc.php"; 

    // Substitute your project name Here 
    public final String PROJECT_NAME = "ProjectName"; 

    // Substitute your test plan Here 
    public final String PLAN_NAME = "Regression"; 

    // Substitute your build name 
    public final String BUILD_NAME = "Build_Auto"; 


public void updateTestLinkResult(String testCase, String exception, String result) throws TestLinkAPIException { 
     TestLinkAPIClient testlinkAPIClient = new TestLinkAPIClient(DEV_KEY, 
           SERVER_URL); 
     testlinkAPIClient.reportTestCaseResult(PROJECT_NAME, PLAN_NAME, 
           testCase, BUILD_NAME, exception, result); 
    } 


String exception = null; 
     try { 
       driver.navigate().to("http://www.wikipedia.org/wiki/Main_Page"); 
       result = TestLinkAPIResults.TEST_PASSED; 
       updateTestLinkResult("AT-1", null, result); 
     } catch (Exception ex) { 
       result = TestLinkAPIResults.TEST_FAILED; 
       exception = ex.getMessage(); 
       updateTestLinkResult("AT-1", exception, result); 
     } 
0
 @Prasad I am using assertion before creating result like this: 

     try { 

      driver.navigate().to("http://www.wikipedia.org/wiki/Main_Page"); 
      Assert.assertEquals(ActualTitle, ExpextedTitle); 
      result = TestLinkAPIResults.TEST_PASSED; 
      updateTestLinkResult("AT-1", null, result); 

      } 
      catch (Exception ex) 
     { 
      result = TestLinkAPIResults.TEST_FAILED; 
      exception = ex.getMessage(); 
      updateTestLinkResult("AT-1", exception, result); 
      } 


     But I don't know why result are not showing in testlink. Can you 
     please tell me better approach to use Assertion here. 
相關問題