以下のプロセスに従って、テスト リンクのテスト結果を更新します。
- リンクから 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);
}