I'm new to Testlink API. I need some help if possible...
The mean feature which i like to use is: testLinkReport.
I have three questions in front:
1. How can I see the Test Case ID, using the GUI?
2. How can I see the Test Plan ID, using the GUI?
3. How can I add a comment?
I tried the following code:
Code: Select all
public static void testLinkReport(int tcid, int tpid, String status)
{
try
{
XmlRpcClient rpcClient;
XmlRpcClientConfigImpl config;
config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(SERVER_URL));
rpcClient = new XmlRpcClient();
rpcClient.setConfig(config);
ArrayList<Object> params = new ArrayList<Object>();
Hashtable<String, Object> executionData = new Hashtable<String, Object>();
executionData.put("devKey", DEV_KEY);
executionData.put("tcid", tcid);
executionData.put("tpid", tpid);
executionData.put("status", status);
params.add(executionData);
Object[] result = (Object[]) rpcClient.execute("tl.reportTCResult", params);
// Typically you'd want to validate the result here and probably do something more useful with it
System.out.println("Result was:\n");
for (int i=0; i< result.length; i++)
{
Map item = (Map)result[i];
System.out.println("Keys: " + item.keySet().toString() + " values: " + item.values().toString());
}
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (XmlRpcException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
// Substitute this for a valid tcid and tpid within your project
TestLink.testLinkReport(5, 2, "p");
}
Result was:
Keys: [message, code] values: [(reportTCResult) - No Test Case ID (internal id) provided., 110]
How can I avoid that error? How/Which Test Case ID do I have to provide?
I hope somebody can help me,
With kind regards,
Roy de Kleijn