0

有人可以解释如何链接 webdriver 脚本 [用 eclipse 编写的测试] 来测试链接测试并相应地更新结果吗?

例如,在我的 webdriver 测试计划中,我的测试看起来像这样 [一个班级拥有我所有的测试]

@Test
testA
{
}

@Test
testB
{
}
@Test
testC
{
}

我在我的测试链接数据库中为 testA、testB、testC 定义了相应的测试用例。

当我运行脚本时,测试链接数据库中的测试需要根据通过/失败标准进行相应更新。

我的测试中使用的环境是

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

3 回答 3

0

如果您使用 java 来开发您的 webdriver 脚本,您可以使用 teslink java api 并使用 testng 侦听器更新测试用例状态。..基本上,您需要有 Testng 侦听器,它会与testlink api对话以更新测试用例的状态。如果您不了解 testng 侦听器,这里是 TestListenerAdapter 的 java api 链接

于 2014-03-08T14:26:45.840 回答
0

按照下面提到的过程更新测试链接中的测试结果:

  • 从链接下载Test Link jar
  • 在测试链接中,从我的设置 > 个人 API 访问密钥中获取 DEV_KEY
  • 使用 DEV_KEY 和 SERVER_URL 创建 TestLinkAPIClient 的实例
  • 并使用项目名称、测试计划名称、测试用例、构建和结果报告测试用例结果。

有关更多信息,请参阅示例代码:

     // 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);
         }
于 2016-03-10T07:34:30.030 回答
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. 
于 2017-11-17T06:07:12.420 回答