Python's Testlink module

Source: Internet
Author: User
Tags testlink

1. Install: Pip Install Testlink-api-python-client

2.Python Connection on Testlink:

1 Import Testlink 2 3 ' http://10.138.30.4:82/testlink/lib/api/xmlrpc/v1/xmlrpc.php ' 4 ' 14115ec841a5c22a5b095158d2eb7 ' 5 6 TLC = Testlink. Testlinkapiclient (URL, key)

3. Get the information on the Testlink:

1 defget_information_test_project ():2     Print("Number of Projects in Testlink:%s"%tlc.countprojects ())3     Print("Number of platforms (in Testplans):%s"%tlc.countplatforms ())4     Print("Number of Builds:%s"%tlc.countbuilds ())5     Print("Number of Testplans:%s"%Tlc.counttestplans ())6     Print("Number of testsuites:%s"%tlc.counttestsuites ())7     Print("Number of testcases (in testsuites):%s"%tlc.counttestcasests ())8     Print("Number of testcases (in Testplans):%s"%TLC.COUNTTESTCASESTP ())9Tlc.listprojects ()

4. Get test suite:

1 defget_test_suite ():2Projects =tlc.getprojects ()3Top_suites = Tlc.getfirstleveltestsuitesfortestproject (projects[0]["ID"])4      forSuiteinchtop_suites:5         Print(suite["ID"], suite["name"])

5. Create a test case set:

1 def Create_test_suite (project_id, Test_suite_name, Test_suite_describe, father_id): 2     if "" : 3         tlc.createtestsuite (project_id, Test_suite_name, Test_suite_describe)4     Else : 5         Tlc.createtestsuite (project_id, Test_suite_name, Test_suite_describe, parentid=father_id)

6. Create a test case:

 1  def   Create_test_case (father_id, data):  2  tlc.initstep (data[0][2], data[0][3     ], automation)  3  for  i in  range (1  4  tlc.appendstep (data[i][2]     , Data[i][3], automation)  5  Tlc.createtestcase (Data[0][0], father_id,  " 1   ", "   Timen.xu   ", , Preconditions=data [0] [1]) 

7. Get the test case:

1 defget_test_case (test_case_id):2Test_case = Tlc.gettestcase (None, testcaseexternalid=test_case_id)3      forIinchtest_case:4         Print("sequence","Perform steps","Expected results")5          forMinchI.get ("Steps"):6             Print(M.get ("Step_number"), M.get ("Actions"), M.get ("Expected_results"))

8. Send the test results to Testlink:

1 def Report_test_result (test_plan_id, test_case_id, Test_result): 2     " ", guess=True,3                        testcaseexternalid=test_case_id, platformname="  0")

Note: The result feedback for each step is temporarily not supported by sending the test results to the testlink,1.9.14 version, and the next version 1.9.15 can support each step result feedback.

Article Source: http://blog.csdn.net/temanm/article/details/51505474

Python's Testlink module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.