Can't save results in testlink

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Can't save results in testlink

Postby Roy » Fri Apr 02, 2010 1:26 pm

Hi All,

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");   
   }


But I'm getting the following error message:
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
Roy
TestLink user
 
Posts: 3
Joined: Fri Apr 02, 2010 1:14 pm

Postby austvik » Sat Apr 03, 2010 1:08 pm

Hi, Roy.

In the version of lib/api/xmlrpc.php that I have (the latest in CVS), these parameters are called testcaseid and testplanid. It could be a good idea to check what they are called in your version and if your client application uses the same parameter names.

As for ids, my crude way of getting them is either checking the database, or looking at the URLs.

For test plan, you could e.g. go to Project -> Test Plan Management -> Mouse over the test plan you want, and see a &tplan_id=nnn in the status bar. nnn is the id of the project.

For test cases, you can e.g. go to Specification -> mouse over the test case you want in the menu, and see ET(nnn) in the status bar. nnn is the ID of the test case.
austvik
Advanced user
 
Posts: 24
Joined: Thu Mar 25, 2010 7:25 am

Postby fman » Sun Apr 04, 2010 10:24 am

When you configure TL to use API, on several feature you get a BRICK ICON, and clicking on it the internal ID is displayed.
This is not done for Test Case, test case version. If you think can be useful => add a request on mantis.

All other info you need can be got from reading the code that implements the different API CALLS
fman
Member of TestLink Community
 
Posts: 3062
Joined: Tue Nov 15, 2005 7:19 am

Postby Roy » Wed Apr 07, 2010 11:28 am

@austvik: I followed your steps. And unfortunately it's not working.

this is the way how I invoke the method:
TestLink.testLinkReport(7, 1, "p");

This is the error message:
Keys: [message, code] values: [(reportTCResult) - No Test Case ID (internal id) provided., 110]


I hope that somebody experienced the same problem and can help me out.

Much appreciated,
Roy de Kleijn
Roy
TestLink user
 
Posts: 3
Joined: Fri Apr 02, 2010 1:14 pm

Postby austvik » Wed Apr 07, 2010 1:00 pm

Hi Roy.

You show me the way you call the method TestLink.testLinkReport(). What I am saying is that maybe "tcid" and "tpid" inside that function is wrong, and that the way to check this is to look in lib/api/xmlrpc.php.

I think what you mean by "I followed your steps" was that you used the methods I described to get the IDs, but if they are provided in parameter names that were wrong (e.g. "tcid" instead of "testcaseid"). I think you would still get the error message which you get, even with the correct numbers.

The error message is "No Test Case ID (internal id) provided.", not "Wrong Test Case ID". If you are not familiar with reading and editing PHP code (to figure out wheter to use tcid or testcaseid, tpid or testplanid), I think you could try (just to check if it works) to change these two lines in your first posting:

executionData.put("tcid", tcid);
executionData.put("tpid", tpid);

to:

executionData.put("testcaseid", tcid);
executionData.put("testplanid", tpid);
austvik
Advanced user
 
Posts: 24
Joined: Thu Mar 25, 2010 7:25 am

Postby Roy » Wed Apr 07, 2010 1:33 pm

Thanks for your help. it's working now :D
Roy
TestLink user
 
Posts: 3
Joined: Fri Apr 02, 2010 1:14 pm


Return to XML-RPC API



Who is online

Users browsing this forum: No registered users and 2 guests