tl.addTestCaseToTestPlan
Posted: Mon May 24, 2010 8:27 am
hi, im using the java api and testlink 1.8.5. i really need to add testcases into a testplan. Everything was passed in correctly.
No errors were shown. However, testcases that were added into a particular testplan did not appeared after i run this methods.. sigh... 
Code: Select all
public static Object[] AddTestcases(String dev_key, int tpid, int Testid,
String excaseid, int version) {
String[] params = { "devKey", "testprojectid", "testplanid",
"testcaseexternalid", "version" };
Object[] values = { DEV_KEY, tpid, Testid, excaseid, version };
System.out.println("values: " + DEV_KEY + " " + tpid + " " + Testid
+ " " + excaseid + " " + version);
Object[] result = callAddCase("tl.addTestCaseToTestPlan", params,
values);
return result;
}
Code: Select all
public static Object[] callAddCase(String method, String[] param,
Object[] values) {
try {
XmlRpcClient rpcClient;
XmlRpcClientConfigImpl config;
// tpid = 15;
config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(SERVER_URL));
rpcClient = new XmlRpcClient();
rpcClient.setConfig(config);
// HashMap hm = new HashMap();
ArrayList<Object> arraylist = new ArrayList<Object>();
HashMap<String, Object> hm = new HashMap<String, Object>();
// Hashtable<String, Object> executionData = new Hashtable<String,
// Object>();
hm = new HashMap<String, Object>();
for (int i = 0; i < param.length; i++) {
hm.put(param[i], values[i]);
}
arraylist.add(hm);
System.out.println(arraylist);
Object[] result = (Object[]) rpcClient.execute(
"tl.addTestCaseToTestPlan", arraylist);
return result;
} catch (Exception e) {
return null;
}
}
