lczub / TestLink-API-Python-client

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

How to assign Testers to the test cases while running addtestcase/createtestcase/addtestcasettotestplan #19

Closed rishabhzonka closed 10 years ago

rishabhzonka commented 10 years ago

Hi,

First of all thanks a ton for writing this api call. It really helps a lot. I have one ques regarding how to assign testers to testcases while reporing test case results to the testplan or at any other moment.

Thanks in Advace.

Rishabh "Neozonka" Agarwal

lczub commented 10 years ago

Hello Neozonka,

I take I look into the latest TL code xmlrpc.class.php from GITORIOUS and find no api function, a client could call to assign a tester, before the test case is executed.

The functions reportTCResult assigns tester to the execution results by evaluating the argument devKey. Default behaviour of TL-API-PY-Client is, that if you not assign a separate argument devKey to the call, the initialise TL-API-PY-Client value is used. But if you assign a separate argument, this one is used instead.

Here is an example, how you can submit a execution result assigned to a different tester.

   import testlink
   tlh = testlink.TestLinkHelper('http://[YOURSERVER]/testlink/lib/api/xmlrpc/v1/xmlrpc.php',  
                                            'DEVKEY-TESTER-1')
   tlapi = tlh.connect(testlink.TestlinkAPIClient)
   reportTCResult(newTestPlanID_A, 'p', 
                buildid=newBuildID_A, testcaseid=newTestCaseID_B, 
                platformname=NEWPLATFORM_B, notes="first try", devKey='DEVKEY-TESTER-2')

This should insert an execution result for test case B tested by 'TESTER-2'. That's all you can do currently from the client side. The TL server allows not more via the api.

If you need more api functionality, you have to open an enhancement issue agains TL itself via http://mantis.testlink.org/

Hope, this helps a little bit. Greetings Luiko

lczub commented 10 years ago

Hello Rishabh,

sorry, the example includes a failure, it initialise a TestlinkAPIClient instance , but uses a TestlinkAPIGeneric call syntax.

Example TestlinkAPIGeneric

import testlink
   tlh = testlink.TestLinkHelper('http://[YOURSERVER]/testlink/lib/api/xmlrpc/v1/xmlrpc.php',  
                                            '[DEVKEY-TESTER-1]')
   tlapi = tlh.connect(testlink.TestlinkAPIGeneric)
   reportTCResult(newTestPlanID_A, 'p', 
                buildid=newBuildID_A, testcaseid=newTestCaseID_B, 
                platformname=NEWPLATFORM_B, notes="first try", devKey='[DEVKEY-TESTER-2]')

Example TestlinkAPI

import testlink
   tlh = testlink.TestLinkHelper('http://[YOURSERVER]/testlink/lib/api/xmlrpc/v1/xmlrpc.php',  
                                            '[DEVKEY-TESTER-1]')
   tlapi = tlh.connect(testlink.TestlinkAPI)
   reportTCResult(newTestCaseID_B, newTestPlanID_A, newBuildID_A, 'p', 'first try',
                platformname=NEWPLATFORM_B, devKey='[DEVKEY-TESTER-2]')

Is it OK for you to close this issue? Greetings Luiko

rishabhzonka commented 10 years ago

Thanks Luiko for the example. I have one question.

the format DEVKEY-TESTER-1 means i should use the DEVKEY and my username(testername) in this format.

ex: 091834098fs09138df-rishabhagarwal ????

lczub commented 10 years ago

Hello Rishabh,

sorry for the misunderstanding. DEVKEY-TESTER-1 means the DEVKEY of Tester-1. So just '091834098fs09138df'

rishabhzonka commented 10 years ago

I did that but still the uploaded results are without tester assigned.... :(

lczub commented 10 years ago

Interesting, I run the example TestLinkExample.py with following modification

...
# report Test Case Results for platform 'Big Bird'
# TC_AA failed, build should be guessed, TC identified with external id
newResult = myTestLink.reportTCResult(None, newTestPlanID_A, None, 'f', '', guess=True,
                                      testcaseexternalid=tc_aa_full_ext_id,
                                      platformname=NEWPLATFORM_A, devKey='361451...46d')
...

and it creates an execution result with a different tested by entry as the other results.

One possible pitfall could be, that the argument names are case sensitive. Have your argument name 'devKey' a big 'K' ?

rishabhzonka commented 10 years ago

I think Tested by and Tester assigned are two different things. I need the feature Tester assign per build under test execution in order to get proper test result metrics.

lczub commented 10 years ago

That's true. That's what I want to told you in the first response with

and find no api function, a client could call to assign a tester, before the test case is executed. ... This should insert an execution result for test case B tested by 'TESTER-2'. That's all you can do currently from the client side. The TL server allows not more via the api. If you need more api functionality, you have to open an enhancement issue agains TL itself via http://mantis.testlink.org/

You want to assign a tester, before a test is executed. With TestLink 1.9.9, you have to made this assignments over the TL web gui or have to open an enhancement issue agains TL itself via http://mantis.testlink.org/ and then wait, till the TestLink development has agree your suggestion and implemented it.

rishabhzonka commented 10 years ago

I already opened an issue in Mantis requesting this feature... lets see... Currently I'm doing this via GUI but I have 32 test suite with 6000 test cases per build. So if I execute multiple times per week then its pain in the ass to assing tester to every test suite manually.

I really appreciate helping me out Luiko. A beer is due from me :D

lczub commented 10 years ago

Let me know, when TL has implemented your request. I will than adapt this python client.

mykaul commented 10 years ago

What is the mantis ticket opened? I'm also looking for such support, including the ability to assign a test case to a build.

lczub commented 10 years ago

Hello Yaniv,

sorry for the late response. I have to guess, but I think, the mantis ticket, your are looking for is http://mantis.testlink.org/view.php?id=6184

Greetings Luiko

lczub commented 10 years ago

The requirements for the python api client is currently unclear. Could you describe, which additional function is needed and how it should / could be realized with a combination of existing api methods? Cheers Luiko

mykaul commented 10 years ago

I don't think, at the moment, there are any requirements that will solve this specific issue - the functionality required is @ http://mantis.testlink.org/view.php?id=6324 There is a new functionality added to 1.9.10, which allows another parameter 'user' to be used to set who ran the test (overriding the dev-key), you may want to add it to the python client.

lczub commented 10 years ago

reportTCResult() optional parameter 'user' is now supported (see f65eaa8) tests are welcome with pre-release v0.5.0-Beta

mykaul commented 10 years ago

The above will only add the user who executed the test, it will not assign it. This will make the test executed still not to be reported under some statistics. Apparently, in 1.9.11 there's a new API to assign a user to a test case - but we could not get it to work. See http://mantis.testlink.org/view.php?id=6331 .

Again, we implemented it in Python to try it out - and it did not work for us.

lczub commented 10 years ago

Hello Yaniv, thanks for the hint with the future TL api method assignTestCaseExecutionTask. I have open a separate task #26 for it. I will try to implement it in a separate branch in the next days. Let us move this discussion to the new task #26. Luiko

lczub commented 10 years ago

Hello Yaniv,

FYI - the latest TestLink gitorious code includes fixes for a) TestLink 0006433: Add test case to test plan with assigning user raise PHP Fatal error b) TestLink 0006440: assignTestCaseExecutionTask does not assign user

This should solve your problems.

In pre-release v0.5.1-Alpha you find also a first TestLink-API-Python-client implementation for this new api.

Luiko