按照下面提到的过程更新测试链接中的测试结果:
- 从链接下载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);
}