Page 1 of 2
reportTCResult does not return anything
Posted: Tue Mar 23, 2010 1:42 pm
by Jorryt
At this moment I am looking of testlink can be a good alternative for our current Test report software.
Everything looks to work perfect accept one thing which I can not get working javascript:emoticon(':lol:')
I am trying to save some testresult by using the reportTCResult().
But the functions does not work as I was hoping.
At the moment I do a call with some invalid parameters an exception is returned. But at the moment I send a call with (I think valid parameters) no result is send.
I am using the following code
Code: Select all
// Report test case result in new build.
params = new ArrayList<Object>();
executionData = new Hashtable<String, Object>();
executionData.put("devKey", DEV_KEY);
executionData.put("testcaseid", 577);
executionData.put("testplanid", 1);
executionData.put("buildid", 1);
executionData.put("status", "p");
params.add(executionData);
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 reportTCResult:\n" + result.length);
for (int i = 0; i < result.length; i++) {
Map item = (Map) result[i];
System.out.println("Keys: " + item.keySet().toString()
+ " values: " + item.values().toString());
}
I am using Testlink version 1.9 beta 3.
Is it possible that this is a defect in beta 3 or am I doing something wrong
I hope some can help me

Posted: Thu Mar 25, 2010 1:09 pm
by ambrish
I am facing the same problem. Creating a build works fine, but updating the status of a test case using reportTCResult does not seem to do anything.
I'm using 1.9 (Beta 3)
I'm still trying and if I get through i'll post on this thread.
Cheers
Posted: Thu Mar 25, 2010 1:23 pm
by GuillaumeThebault
I had that problem before as well. After close inspection of the code I found a workaround.
Here's a link to the defect that I posted on the Bug tracking system in which you can find an enclosed file that corrects that problem:
http://www.testlink.org/mantis/view.php?id=3243
Posted: Thu Mar 25, 2010 2:30 pm
by Jorryt
Thanks for helping after changing the xmlrpc there was a return with a error on the platform id. After adding this param everything is working fine

Posted: Thu Mar 25, 2010 2:36 pm
by ambrish
is platform ID mandatory ?
Here's my code
def reportTCResult(self, tcid, tpid, buildid, status):
data = {"devKey":self.devKey, "testcaseid":tcid, "testplanid":tpid,
"buildid":buildid, "status":status}
return self.server.tl.reportTCResult(data)
TCResult = client.reportTCResult(4, 10, 1, "p")
print "reportTCResult result was: %s" %(TCResult)
Output:
reportTCResult result was: [{'message': '(reportTCResult) - Test plan (name:MyTestPlan) has no platforms linked', 'code': 3041}]
@GuillaumeThebault - thanks for the feedback.
Posted: Thu Mar 25, 2010 2:47 pm
by ambrish
I use python and my values are hardcoded just for testing.
testcase ID = 4
test plan ID = 10
build = 1
I've confirmed the IDs directly from the database as well
ambrish wrote:is platform ID mandatory ?
Here's my code
def reportTCResult(self, tcid, tpid, buildid, status):
data = {"devKey":self.devKey, "testcaseid":tcid, "testplanid":tpid,
"buildid":buildid, "status":status}
return self.server.tl.reportTCResult(data)
TCResult = client.reportTCResult(4, 10, 1, "p")
print "reportTCResult result was: %s" %(TCResult)
Output:
reportTCResult result was: [{'message': '(reportTCResult) - Test plan (name:MyTestPlan) has no platforms linked', 'code': 3041}]
@GuillaumeThebault - thanks for the feedback.
Posted: Thu Mar 25, 2010 2:54 pm
by GuillaumeThebault
ambrish wrote:is platform ID mandatory ?
The following is what you find in xmlrpc.php's source code. It is included in the description of reportTCResult:
* @param string $args["platformid"] - optional, if not present platformname must be present
* @param string $args["platformname"] - optional, if not present platformid must be present
So to answer your question, and from what I remember, yes you have to provide a platformid to make it work.
Posted: Thu Mar 25, 2010 2:58 pm
by ambrish
ok i just realised that 1.9 is a bit different. We are still using 1.6. I forgot to assign a "platform" to the actual test plan
That is done.
Now another error
reportTCResult result was: [{'status': True, 'operation': 'reportTCResult', 'message': 'Success!', 'overwrite': False, 'id': '2'}]
Posted: Thu Mar 25, 2010 3:01 pm
by GuillaumeThebault
ambrish wrote:ok i just realised that 1.9 is a bit different. We are still using 1.6. I forgot to assign a "platform" to the actual test plan
That is done.
Now another error
reportTCResult result was: [{'status': True, 'operation': 'reportTCResult', 'message': 'Success!', 'overwrite': False, 'id': '2'}]
According to your message, it looks perfectly fine to me. Look at the field message in the reply that says "Success!". Are you sure that this is not working?
Posted: Thu Mar 25, 2010 3:04 pm
by ambrish
When i log in to the web interface, the test cases in the test plan are still on "not run" status.
I have a fresh testlink installation, with one prject, one plan, 3 test cases and one build.
what's 'overwrite': 'False' and 'id': '2' ?
I ran the script again and i got 'id': '3'
It appears to increment
Posted: Thu Mar 25, 2010 3:19 pm
by ambrish
ah, just figured that out - the id increaments are from the "executions" table.
Posted: Thu Mar 25, 2010 3:38 pm
by ambrish
ok, some mor einsight,
When i run the script the execution table entry looks like this (my script script mentioned in my earlier post):
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | notes |
4 | 1 | 1 | 25.03.2010 16:27:15 | p | 10 | 5 | 1 | 0 | 2 | null |
When i manually update the test result through the web interface, it looks like this:
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | notes |
5 | 1 | 1 | 25.03.2010 16:28:10 | p | 10 | 5 | 1 | 1 | 1 | null |
what beats me now is the platform_id (In my script I pass is explicitly as 1) and the difference in execution_type (is that a flag for API usage and manual usage ?)
Posted: Thu Mar 25, 2010 3:44 pm
by GuillaumeThebault
Yes execution_type indicates whether you're using manual or automated execution. I can't really help you more than that today cause my testlink server isn't reachable at the moment.
But you should be able to obtain the same platformid even if you're using the API. The problem I think here is likely to come from your python code, as my Java code passes the value without any problems.
Posted: Thu Mar 25, 2010 7:50 pm
by Jorryt
ambrish wrote:ok i just realised that 1.9 is a bit different. We are still using 1.6. I forgot to assign a "platform" to the actual test plan
That is done.
Now another error
reportTCResult result was: [{'status': True, 'operation': 'reportTCResult', 'message': 'Success!', 'overwrite': False, 'id': '2'}]
In the begin I had the same result as you.
So I take a look into the database and saw that the platform id was not set.
At the moment I set the platformId manual in the database the result become visible.
So I add the platformId to the call to the reportTCResult methode and everythings works fine for me

Posted: Fri Mar 26, 2010 11:13 am
by ambrish
I also pass the platformid explicitly but as you see from my post earlier
When i run the script the execution table entry looks like this (my script script mentioned in my earlier post):
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | notes |
4 | 1 | 1 | 25.03.2010 16:27:15 | p | 10 | 5 | 1 | 0 | 2 | null |
When i manually update the test result through the web interface, it looks like this:
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | notes |
5 | 1 | 1 | 25.03.2010 16:28:10 | p | 10 | 5 | 1 | 1 | 1 | null |
When i run manually the platform id is set correctly as 1 but through the script even after explicitly passing it as 1, it sets it to 0.
i'm still fighting
