Python之TestLink模組

來源:互聯網
上載者:User

標籤:detail   stl   print   one   test   forms   code   資訊   php   

1.安裝:pip install TestLink-API-Python-client

2.Python串連上TestLink:

1 import testlink2 3 url = ‘http://10.138.30.4:82/testlink/lib/api/xmlrpc/v1/xmlrpc.php‘4 key = ‘14115ec841a5c22a5b095158d2eb7‘5 6 tlc = testlink.TestlinkAPIClient(url, key)

3.擷取TestLink上的資訊:

1 def get_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())9     tlc.listProjects()

4.擷取test suite:

1 def get_test_suite():2     projects = tlc.getProjects()3     top_suites = tlc.getFirstLevelTestSuitesForTestProject(projects[0]["id"])4     for suite in top_suites:5         print (suite["id"], suite["name"])

5.建立測試案例集:

1 def create_test_suite(project_id, test_suite_name, test_suite_describe, father_id):2     if father_id == "":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.建立測試案例:

1 def create_test_case(father_id, data):2     tlc.initStep(data[0][2], data[0][3], automation)3     for i in range(1, len(data)):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.擷取測試案例:

1 def get_test_case(test_case_id):2     test_case = tlc.getTestCase(None, testcaseexternalid=test_case_id)3     for i in test_case:4         print ("序列", "執行步驟", "預期結果")5         for m in i.get("steps"):6             print (m.get("step_number"), m.get("actions"), m.get("expected_results"))

8.發送測試結果給TestLink:

1 def report_test_result(test_plan_id, test_case_id, test_result):2     tlc.reportTCResult(None, test_plan_id, None, test_result, "", guess=True,3                        testcaseexternalid=test_case_id, platformname="0")

備忘:發送測試結果給TestLink,1.9.14版本暫時不支援每個步驟的結果反饋,下一個版本1.9.15可支援每個步驟結果反饋。

文章來源:http://blog.csdn.net/temanm/article/details/51505474

Python之TestLink模組

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.