lczub / TestLink-API-Python-client

A Python client to use the TestLink API
104 stars 63 forks source link

How to create an Issue on Issue tracker #112

Closed Lakshmipathi closed 5 years ago

Lakshmipathi commented 5 years ago

Hi.

Is it possible to create an new issue on issue tracker(ex: gitlab). I tried below one - but it needs existing bug (on gitlab).

result = tlink.reportTCResult(testcase_id, testplan_id, build_name,'f', "mesg ", steps=result_steps, bugid="100")

Thanks for any pointers/help.

Lakshmipathi commented 5 years ago

Found this note on TestLink


Add Bugs to Test Case

(only if it is configured) TestLink has a very simple integration with Bug Tracking Systems (BTS), not being able either send a bug creationg request to BTS, neither get back the bug id. The integration is done using links to pages on BTS, that calls the following features:

    Insert new bug.
    Display existent bug info.

Process to add a bug

    Step 1: use the link to open BTS to insert a new bug.
    Step 2: write down the BUGID assigned by BTS.
    Step 3: write BUGID on the input field.
    Step 4: use add bug button.

After closing the add bug page, you will see relevant bug data on the execute page. 

Thus its not possible to create issue from api. closing this issue I think I was wrong, I can create new issue from web-ui. Would like to know whether is it possible from this client too?

lczub commented 5 years ago

Hello Lakshmipathi, I must disappoint you, the python api client can only serve you functions, the TL server itself allows to call. And related to issue trackers, that i snot much - see xmlrpc.class public api method

For more function, the TL server itself must implement a matching public php functions. Afterwards the api clients can use them.

Hope this helps to understand the dependencies. Regards Luiko

Lakshmipathi commented 5 years ago

Hi Luiko,

Thanks for the response. I was checking the source- Couple of interesting points:

testlink-code/lib/issuetrackerintegration/gitlabrestInterface.class.php:addIssue() - I guess it is used to create new issure on gitlab issue tracker.

reportTCResult() does something on given bug: https://github.com/TestLinkOpenSourceTRMS/testlink-code/blob/testlink_1_9/lib/api/xmlrpc/v1/xmlrpc.class.php#L2408 Looks like _insertExecutionBug simply inserts given bug-id in db execution_bugs table.

So TestLink currently doesn't expose (via xmlrpc) option to create new issue. Thus client (TestLink-API-Python-client) has no way to achieve this. If TestLink introdues new api (ex:reportTCResultwithBugs()), then TestLink-API-Python-client should be able to support those calls.

Possible workaround, go ahead and invoke gitlab call directly just before calling reportTCResult()

import requests requests.post("http://gitlab-ipaddr/api/v4/projects/1/issues", data={"title":"T1","description":"desc"},headers={"PRIVATE-TOKEN":"dev_key"}) Then fetch bug-id from response and then pass it to reportTCResult()

Thanks for the help and details.

Lakshmipathi commented 5 years ago

Marking this as resolved. thanks