1. Download the relevant JAR package
2. Get to Testlink URL and key, note: URL is not testlink connection address, is the connection address +/lib/api/xmlrpc.php
3. Test if the connection is successful
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 ());}
After running, a hello appears to indicate a successful connection
4. Change test Case Execution Results
Get the test plan ID
Integer Testplanid = Api.gettestplanbyname ("New Repayment Method (latest)", "Trading System"). GetId ();
String buildname = "Transaction new repayment method";
Integer Testcaseid = 3734;
Api.reporttcresult (Testcaseid, NULL, Testplanid, executionstatus.failed, NULL, Buildname, "notes for automated upload results", NULL, NULL, NULL, NULL, NULL, or NULL);
The associated use case ID and buildname can be obtained from the exported test plan XML file. Such as
Appendix:
Testlink Common methods: http://testlinkjavaapi.sourceforge.net/implemented_methods.html
Testlink Interface: http://testlinkjavaapi.sourceforge.net/structure.html
How Java connects Testlink