getTestCasesForTestsuite doesn't return steps

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
martinM
TestLink user
Posts: 11
Joined: Tue Sep 29, 2009 9:06 am

getTestCasesForTestsuite doesn't return steps

Post by martinM »

Hi all,

I'm using TestLink 1.9.2 and want to get all steps of a test-case.
I'm calling getTestCasesForTestsuite() but I can't get the steps.

I tried setting "details" to "simple" and "full" but didn't succeed.

Is there a third value for the "details" parameter or is this a bug?

Here is what I get returned, if I set details to "full":

{'modification_ts': '2011-03-30 10:26:07', 'node_type_id': '3', 'author_id': '1', 'summary': '<p>13 Payment with account</p>', 'version': '1', 'node_order': '101', 'parent_id': '3', 'status': '1', 'creation_ts': '2011-03-29 15:43:55', 'node_table': 'testcases', 'execution_type': '1', 'updater_id': '1', 'layout': '1', 'name': '13 Payment with account', 'tsuite_name': 'Test suite 2', 'importance': '2', 'active': '1', 'id': '10', 'is_open': '1', 'tc_external_id': '4', 'external_id': 'qt-4', 'preconditions': '<p>ww</p>', 'tcversion_id': '3'}


Thanks in advance!

Best Regards,
Martin
Unhandled
Advanced user
Posts: 67
Joined: Sun Jan 23, 2011 11:28 pm

Re: getTestCasesForTestsuite doesn't return steps

Post by Unhandled »

Sorry, I haven't experience with 'getTestCasesForTestSuite()'

What if you try 'getTestCasesForTestPlan()' ? See optional paramter: @param array $args["getstepinfo"] - optional - default false

Code: Select all

/**
   * getTestCasesForTestPlan
   * List test cases linked to a test plan
   *
   * @param struct $args
   * @param string $args["devKey"]
   * @param int $args["testplanid"]
   * @param int $args["testcaseid"] - optional
   * @param int $args["buildid"] - optional
   * @param int $args["keywordid"] - optional mutual exclusive with $args["keywords"]
   * @param int $args["keywords"] - optional  mutual exclusive with $args["keywordid"]
   *
   * @param boolean $args["executed"] - optional
   * @param int $args["$assignedto"] - optional
   * @param string $args["executestatus"] - optional
   * @param array $args["executiontype"] - optional
   * @param array $args["getstepinfo"] - optional - default false
   *
   * @return mixed $resultInfo
   */
martinM
TestLink user
Posts: 11
Joined: Tue Sep 29, 2009 9:06 am

Re: getTestCasesForTestsuite doesn't return steps

Post by martinM »

Hi unhandeld,

thanks for your suggestion.
But in my use-case I don't want to rely on a certain test-plan. I just want to get all test-cases of a test-project including the test-steps.

Best Regards,
Martin
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: getTestCasesForTestsuite doesn't return steps

Post by fman »

have you read the documentation inside code as was done by unhandeld ?
martinM
TestLink user
Posts: 11
Joined: Tue Sep 29, 2009 9:06 am

Re: getTestCasesForTestsuite doesn't return steps

Post by martinM »

Hi fman,

yes, I read the documentation ;-).

Here it is:

/**
* List test cases within a test suite
*
* By default test cases that are contained within child suites
* will be returned.
* Set the deep flag to false if you only want test cases in the test suite provided
* and no child test cases.
*
* @param struct $args
* @param string $args["devKey"]
* @param int $args["testsuiteid"]
* @param boolean $args["deep"] - optional (default is true)
* @param boolean $args["details"] - optional (default is simple)
* use full if you want to get
* summary,steps & expected_results
*
* @return mixed $resultInfo
*
*
*/
public function getTestCasesForTestSuite($args)
{

According to this, I understand, that I need to set "details" to "full" to get the steps of a test-case. Which is not working on TestLink 1.9.2.
So, is this a bug in the documentation or in the API?

Best Regards,
Martin
martinM
TestLink user
Posts: 11
Joined: Tue Sep 29, 2009 9:06 am

Re: getTestCasesForTestsuite doesn't return steps

Post by martinM »

Hi all,

I'm sorry for re-opening this old issue again.

In the meantime I switched to Testlink 1.9.3 and I still encounter troubles call getTestCasesForTestSuite.
My goal is to receive information about a test-case including its steps with one call.
According to the documentation in the file xmlrpc.class.php it should be possible to set the "details" parameter to "full". Then I should receive the steps information.
But this doesn't work.

That's the documentation of the method:

Code: Select all

	/**
	 * List test cases within a test suite
	 * 
	 * By default test cases that are contained within child suites 
	 * will be returned. 
	 * Set the deep flag to false if you only want test cases in the test suite provided 
	 * and no child test cases.
	 *  
	 * @param struct $args
	 * @param string $args["devKey"]
	 * @param int $args["testsuiteid"]
	 * @param boolean $args["deep"] - optional (default is true)
[b]	 * @param boolean $args["details"] - optional (default is simple)
	 *                                use full if you want to get 
	 *                                summary,steps & expected_results[/b]
	 *
	 * @return mixed $resultInfo
	 *
	 *
	 */
	 public function getTestCasesForTestSuite($args)
That's my code (in Jython):

Code: Select all

# -*- coding: latin-1 -*-

import xmlrpclib

from java.lang import String

serverurl = "myURL"
devkey = "mydevKey"

class TestlinkAPIClient:            
    def __init__(self, serverurl, devKey):
        self.serverurl = serverurl
        self.devKey = devKey
        self.server = xmlrpclib.Server(serverurl)
        self.data = {}
        
    def getInfo(self):
        return self.callMethod("about")

    def getTestProjectByName(self, project):
        self.addData("testprojectname", project)
        return self.callMethod("getTestProjectByName")

    def addData(self, key, value):
        self.data[key] = value

    def resetData(self):
        self.data = {}

    def getFirstLevelTestSuitesForTestProject(self, projectid):
        self.addData("testprojectid", projectid)
        return self.callMethod("getFirstLevelTestSuitesForTestProject")

[b]    def getTestCasesForTestSuite(self, suiteid):
        self.addData("testsuiteid", suiteid)
        self.addData("deep", "true")
        self.addData("details", "full")     [/b]   
        return self.callMethod("getTestCasesForTestSuite")

    def getTestSuitesForTestSuite(self, suiteid):
        self.addData("testsuiteid", suiteid)
        self.addData("deep", "true")        
        return self.callMethod("getTestSuitesForTestSuite")
    
    def callMethod(self, method):
        try:
            self.addData("devKey", self.devKey)        
            return eval("self.server.tl." + method + "(self.data)")
        finally:
            self.resetData()

client = TestlinkAPIClient(serverurl, devkey)
suites = client.getFirstLevelTestSuitesForTestProject(1)

for s in suites:
    sid = s['id']
    print sid
    tcs = client.getTestCasesForTestSuite(sid)
    print tcs
If I run this I get lots of information but no steps (although steps are defined in the test-case).
I don't want to use the function for test-plan as I want to be test-plan independent.

Thanks for your suggestions.

Best Regards,
Martin
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: getTestCasesForTestsuite doesn't return steps

Post by fman »

if you think this is an issue you have to open one on mantis
martinM
TestLink user
Posts: 11
Joined: Tue Sep 29, 2009 9:06 am

Re: getTestCasesForTestsuite doesn't return steps

Post by martinM »

Hi fman,

I submitted an issue in Mantis.

See http://mantis.testlink.org/view.php?id=4692.

Best Regards,
Martin
Post Reply