0

I can only see methods to retrieve the test cases if they are bind with any plan. (getTestCasesForTestPlan). I want to retrieve all the test cases written by the user before its used in a plan. Basically, I want to track the count of test cases, written by, created at, all such data before hand (before adding to test plan) through testlink API.

Any suggestions would be appreciated.

0

Giving answer to my own question. I have written a code to implement my question with the help of @fman.

/**
   * Gets a list of test case id's within a project
   *
   * @param struct $args
   * @param string $args["devKey"]
   * @param int $args["testprojectid"]
   * @return mixed $resultInfo
   *         
   * @access public
   */   
  public function getProjectTestCases($args){     
   $messagePrefix="(" .__FUNCTION__ . ") - ";

    $this->_setArgs($args);
    $checkFunctions = array('authenticate','checkTestProjectID');       
    $status_ok=$this->_runChecks($checkFunctions,$messagePrefix);       

    if($status_ok)
    {
      $testProjectID = $this->args[self::$testProjectIDParamName];
      $info=$this->tprojectMgr->get_all_testcases_id($testProjectID, $tcid = []);
      if( !is_null($info) && count($info) > 0 )
      {
          $info = array_values($info);
      }
      return $info;  
    }
    else
    {
      return $this->errors;
    } 
  }

I got some advice from testlink at their forum.

1
  • 1
    Could you please put the key points of your post on the testlink forum into your answer here? That way, if the forum post is ever archived or deleted, the important information will be available here.
    – Kate Paulk
    Jun 9 '17 at 11:43
0

Was looking for an answer myself, but don't know about the java binding or whatever the code pasted above was. I'm using the python bindings on version 1.9.20 this is what worked for me.

tls = testlink.TestLinkHelper().connect(testlink.TestlinkAPIClient)
projects = tls.getProjects()
suiteroots = tls.getFirstLevelTestSuitesForTestProject(projects[0]['id'])
for tlsuite in suiteroots:
    for cases in tls.getTestCasesForTestSuite(testsuiteid=tlsuite['id'], deep=4, details='*'):
        test_case = tls.getTestCase(testcaseid=cases['id'])[0]  # curiously this is always an array of 1 elements
        print(test_case)

Note how getTestCase() returns a list even when you expect only one object , I think in the wild this may well be returning all versions of the test-case? But the version of a test is not a concern for me now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.