码迷,mamicode.com
首页 > 编程语言 > 详细

java如何连接testlink

时间:2015-06-29 19:30:05      阅读:918      评论:0      收藏:0      [点我收藏+]

标签:

1.下载相关的jar包

 

技术分享

2.获取到testlink的url和key,注意:url不是testlink的连接地址,是连接地址+/lib/api/xmlrpc.php

技术分享

3.测试是否连接成功

	public static void main(String args[]) {
        String url = "http://test.tl.gmsd.lan/lib/api/xmlrpc.php";
        String devKey = "223f929e98e3d74fa3c000b67668e305";
        TestLinkAPI api = null;
        
        URL testlinkURL = null;
        
        try     {
                testlinkURL = new URL(url);
        } catch ( MalformedURLException mue )   {
                mue.printStackTrace( System.err );
                System.exit(-1);
        }
        
        //api = new 
        try     {
               api = new TestLinkAPI(testlinkURL, devKey);
        } catch( Exception te) {
                te.printStackTrace( System.err );
                System.exit(-1);
        }
        
        System.out.println(api.ping());
	}

  运行后,出现hello即表明连接成功

 

4. 更改测试用例执行结果

//获取测试计划id
Integer testPlanId = api.getTestPlanByName("新增还款方式(最新)", "交易系统").getId();
String buildName = "交易新增还款方式";

Integer testCaseId = 3734;

api.reportTCResult(testCaseId, null, testPlanId, ExecutionStatus.FAILED, null, buildName, "自动化上传结果的备注", null, null, null, null, null, null);

  相关的用例id和buildname可以从导出的测试计划xml文件中得到。如下图

技术分享

技术分享

 

附录:

testlink常用的方法:http://testlinkjavaapi.sourceforge.net/implemented_methods.html

testlink接口:http://testlinkjavaapi.sourceforge.net/structure.html

 

java如何连接testlink

标签:

原文地址:http://www.cnblogs.com/qiaoyeye/p/4608132.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!