Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003449TestLinkAPI - XMLRPCpublic2010-05-11 05:142010-08-31 20:29
Reporterbrianj 
Assigned Tofman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Fixed in Version1.9 Beta 5 
Summary0003449: addTestCaseToTestPlan() always fails
DescriptionI'm trying to use "addTestCaseToTestPlan()" through the python API, and it always fails with:

[{'message': '(addTestCaseToTestPlan) - Test Case External ID (46862) does not e
xist!', 'code': 5040}]

I've double and triple checked that the testcase external id does in fact exist, and even tried using the testcase id instead of the external id, but both fail with the same message.

Here is some sample code:

   def addTestCaseToTestPlan(self, testcaseid, testplanid, projectid):
      version = 1
      data = {"devKey":self.devKey, "testplanid":testplanid, "testcaseexternalid":testcaseid, "version":version, "testprojectid":projectid, "executionorder":1, "urgency":"high" }
      return self.server.tl.addTestCaseToTestPlan(data)


   print "creating new testcase..."
   tcResult = client.createTestcase("brian", 29266, 46857, "brians_new_test5", "some new test", "burp", "ugly results")
   print tcResult
   
   result = client.getProjects()
   client.printProjects(result)
   
   if (len(tcResult) == 1):
      tc = tcResult[0]
      if tc.has_key('message'):
         if tc['message'] == 'Success!':
            tcid = tc['id']
            print tcid
            if tcid > 0:
               print "adding to test plan..."
               testplanid = 31557
               projectid = 29266
               result = client.addTestCaseToTestPlan(tcid, testplanid, projectid)
               print result


TagsNo tags attached.
Database (MySQL,Postgres,etc)
Browser
PHP Version
TestCaseID
QA Team - Task Workflow Status
Attached Files

- Relationships
has duplicate 0005053closedfman API addTestCaseToTestPlan() always fails with "DB Access Error" 

-  Notes
(0009976)
fman (administrator)
2010-05-11 21:47

We will do a test using PHP and give you some feedback.
have you tried with our PHP examples ?
(0009981)
fman (administrator)
2010-05-12 02:34
edited on: 2010-05-12 02:36

tested on XAMPP bundle with PHP sample client -> Works ok
Just to remember:
test case external ID is the id displayed on GUI and HAVE the prefix.
valued returned by create test case functions is INTERNAL (DB) id

(0009983)
brianj (reporter)
2010-05-12 04:06
edited on: 2010-05-12 04:19

Actually, adding a testcase returns both.

If I do:

tcResult = client.createTestcase("brian", 29266, 46857, "brians_new_test6", "some new test", "some comment", "some result")

print tcResult

I get back:

[{'status': True, 'additionalInfo': {'new_name': '', 'version_number': 1, 'msg':
 'ok', 'status_ok': 1, 'external_id': '9095', 'id': '47093', 'has_duplicate': Fa
lse}, 'operation': 'createTestCase', 'message': 'Success!', 'id': '9095'}]


now, if I do either this:
result = client.addTestCaseToTestPlan(9095, 31557, 29266)

or this:

result = client.addTestCaseToTestPlan(47093, 31557, 29266)

I get:

[{'message': '(addTestCaseToTestPlan) - Test Case External ID (9095) does not ex
ist!', 'code': 5040}]

(except that it complains about 47093 in the second case).

Note that after I run createTestcase I see it on the GUI just fine, it shows up as: Sandbox-9095:brians_new_test6

What I'm not sure though is what you mean by: "displayed on GUI and HAVE the prefix". I also tried passing "Sandbox-9095" instead of just 9095 into addTestcaseToTestPlan, but that just makes it crash. So I'm not sure what prefix you are talking about.

(0009984)
fman (administrator)
2010-05-12 13:36

>> What I'm not sure though is what you mean by: "displayed on GUI and HAVE the prefix".

what you see on testlink after creating a test case.

As I've explained: PHP client works => XMLRPC server works, Then because I've no way to test with other code that PHP client we have only two options:

1. you test with same SERVER enviroment I've tested i.e. get XAMPP BUNDLE with 1.9 BETA 4 and test with your code

2. same that 1 but you test with PHP code

3. test your enviroment (what TL version are you using ? ) with PHP

I will wait for your feedback. From my point of view on 1.9BETA 4 this works => I will wait but set to resolved
(0009987)
brianj (reporter)
2010-05-12 21:19
edited on: 2010-05-12 21:20

we will update to the latest version of testlink this week. In the meantime though, can you please provide a working example (code) where you add a testcase to testlink, then add that testcase to a testplan? You haven't given me a clear answer as to how to utilize the id's that you get back from createTestcase() to use in addTestCaseToTestPlan().

Also, keep in mind that I'm not the only person that has run into this problem. This was reported on the forum previously by others.

(0009989)
fman (administrator)
2010-05-13 00:52
edited on: 2010-05-13 00:53

the working example is present on each distribution of TL:

file: clientAddTestCaseToTestPlan.php

Here is what I've used:

<?php
require_once 'util.php';
require_once 'sample.inc.php';
show_api_db_sample_msg();

$method="addTestCaseToTestPlan";
$unitTestDescription="Test - {$method}";

$args=array();
$args["devKey"]=DEV_KEY;
$args["testprojectid"]=1;
$args["testcaseexternalid"]='TL-8';
$args["version"]=1;
$args["testplanid"]=425;


$debug=true;
$client = new IXR_Client($server_url);
$client->debug=$debug;
runTest($client,$method,$args);
?>

this values work on my installation

(0009993)
brianj (reporter)
2010-05-13 16:03

Ok, we updated to the newest testlink, and I'm now using the "full" external idea as seen on the GUI. But when I do so I still get the crash.

addTestCaseToTestPlan('Sandbox-9095',testplanid, projectid)


Traceback (most recent call last):
  File "c:/piethon/testlinkapi.py", line 275, in <module>
    main()
  File "c:/piethon/testlinkapi.py", line 219, in main
    tcResult = client.createTestcase("brian", projectid, 46857, "brians_new_test
7", "some new test", "some comment", "some result")
  File "c:/piethon/testlinkapi.py", line 82, in createTestcase
    return self.server.tl.createTestCase(data)
  File "C:\python26\lib\xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "C:\python26\lib\xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "C:\python26\lib\xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "C:\python26\lib\xmlrpclib.py", line 1387, in _parse_response
    p.feed(response)
  File "C:\python26\lib\xmlrpclib.py", line 601, in feed
    self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: junk after document element: line 1, column 91


So it looks like now it is recognizing the external id as valid, however it is returning illegal xml which the parser is then choking on.
(0009994)
fman (administrator)
2010-05-13 16:17

Is important to have the returned XML, to feed some XML tool to understand if is really illegal.
Meanwhile when I will have some time will try with perl example.

Please provide TL version you have been using when having all other problems, is important data.
(0009999)
brianj (reporter)
2010-05-13 17:07
edited on: 2010-05-13 17:08

we were using testlink 1.9b4 when I ran the above this morning, but we had to remove it and revert back to an older version (1.8 I believe), because we were running into so many new problems.

I also now realize that this morning it was crashing in createTestcase, where that was at least working before. So something broke that in 1.9b4.

One thing that would really help me help you, would be if you had the latest version of testlink on that demo site (rather than version 1.7.3 like it does now). That way I could easily give you steps and data to reproduce these problems.

(0010000)
fman (administrator)
2010-05-13 18:24

no fixes are planned on 1.8.x branch.
Demo site will be updated after stable release, but because it's nature we can not use it to track issues, then we will always will request detailed steps to reproduce on issues.

Just for the records I've found issue on create test case and will report it.
(0011199)
fman (administrator)
2010-08-31 20:29

Release BETA 6 - 20100831

- Issue History
Date Modified Username Field Change
2010-05-11 05:14 brianj New Issue
2010-05-11 21:47 fman Note Added: 0009976
2010-05-12 02:34 fman Note Added: 0009981
2010-05-12 02:36 fman Note Edited: 0009981
2010-05-12 02:36 fman Status new => assigned
2010-05-12 02:36 fman Assigned To => fman
2010-05-12 02:38 fman Status assigned => feedback
2010-05-12 04:06 brianj Note Added: 0009983
2010-05-12 04:19 brianj Note Edited: 0009983
2010-05-12 13:36 fman Note Added: 0009984
2010-05-12 21:19 brianj Note Added: 0009987
2010-05-12 21:20 brianj Note Edited: 0009987
2010-05-13 00:52 fman Note Added: 0009989
2010-05-13 00:53 fman Note Edited: 0009989
2010-05-13 16:03 brianj Note Added: 0009993
2010-05-13 16:03 brianj Status feedback => assigned
2010-05-13 16:17 fman Note Added: 0009994
2010-05-13 17:07 brianj Note Added: 0009999
2010-05-13 17:08 brianj Note Edited: 0009999 View Revisions
2010-05-13 18:24 fman Note Added: 0010000
2010-05-20 07:06 fman Status assigned => resolved
2010-05-20 07:06 fman Fixed in Version => 1.9 Beta 5
2010-05-20 07:06 fman Resolution open => fixed
2010-08-31 20:29 fman Note Added: 0011199
2010-08-31 20:29 fman Status resolved => closed
2012-06-08 12:14 fman Relationship added has duplicate 0005053
2013-04-25 17:30 fman Category TL API => XMLRPC API
2013-04-25 17:30 fman Category XMLRPC API => API - XMLRPC



Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker