wiki:TestManagerForTracPluginApi

Version 1 (modified by Roberto Longobardi, 14 years ago) (diff)

--

Test Manager for Trac Plugin - Public API

The TestManagerForTracPlugin plugin can be used programmatically to create, edit Test Catalogs, Test Cases and Test Plans, and to set the test execution verdicts of Test Cases in a plan.

In the following, because of the spam filter not allowing more than a few URLs in a page, I have replaced:

http://yourserver/yourproject

with:

<yourserver/yourproject>



Working with Test Catalogs and Test Cases

You can create test catalogs and cases programmatically by means of the following http requests.


Create a root test catalog

Get the following URL:

<yourserver/yourproject>/testcreate?type=catalog&path=TC&title=My%20new%20catalog

this will assign a unique ID (the number 0 in the URL below) to the new catalog and redirect to a Wiki edit page:

<yourserver/yourproject>/wiki/TC_TT0?action=edit&text=%3D%3D+My+new+catalog+%3D%3D

that you can simply post the form to submit the page and thus create the catalog.

Having to POST Wiki pages to submit them is annoying anyway, so I was planning to add an additional parameter to the /testcreate API to directly save the Wiki pages, with no need to edit them eventually. Maybe an additional "force" parameter would allow for resolving conflicts.


Create a sub-catalog

Get the wollowing URL, where "path" is the name of the parent catalog.

<yourserver/yourproject>/testcreate?type=catalog&path=TC_TT0&title=My%20sub%20catalog

this will assign a unique ID (the number 1 in the URL below) to the new catalog and redirect to a Wiki edit page:

<yourserver/yourproject>/wiki/TC_TT0_TT1?action=edit&text=%3D%3D+My+sub+catalog+%3D%3D

that you can simply post the form to submit the page and thus create the sub-catalog.


Create a Test Case

Get the wollowing URL, where "path" is the name of the parent (sub-)catalog.

<yourserver/yourproject>/testcreate?type=testcase&path=TC_TT0_TT1&title=My%20new%20Test%20Case

this will assign a unique ID (the number 0 in the URL below) to the new test case and redirect to a Wiki edit page:

<yourserver/yourproject>/wiki/TC_TT0_TT1_TC0?action=edit&text=%3D%3D+My+new+Test+Case+%3D%3D

that you can simply post the form to submit the page and thus create the test case.



Working with Test Plans and setting the status of a Test Case

You can also create a new Test Plan (e.g. for each nightly build) programmatically as follows.


Create a Test Plan from a specific catalog

Get the wollowing URL, where "path" is the name of the (sub-)catalog to create the test plan against.

<yourserver/yourproject>/testcreate?type=testplan&path=TC_TT0&title=Test%20Plan%20for%2020100818

this will assign a unique ID (the number 1 in the URL below) to the new test plan and redirect to displaying the Test Plan:

<yourserver/yourproject>/wiki/TC_TT0?planid=1

The Test Plan will contain all of the test cases in the specified catalog, with a verdict of "Untested".



Set a Test Case execution verdict, in the context of a Test Plan

Then, you can set the verdict for any test case in the plan, by means of the following.

Get the following URL, where "id" is the Test Case ID and planid is the Test Plan ID:

<yourserver/yourproject>/teststatusupdate?id=5&planid=1&status=SUCCESSFUL

The supported statuses are currently:

  • TO_BE_TESTED
  • SUCCESSFUL
  • FAILED



Traceability between Test Cases and Tickets

You can open a Ticket and have a traceback to the (e.g. failed) Test Case as follows.


Open a Ticket on a Test Case

Whether you deploy TracTicketTemplatePlugin or not, you can get the following URL, where testCaseNumber is the Test Case complete path, planid is the Test Plan ID and planName is its name:

<yourserver/yourproject>/newticket?testCaseNumber=TC_TT0_TC0&planId=1&planName=Test%20Plan%20for%2020100818&description=Test%20Case:%20[wiki:TC_TT0_TC0],%20Test%20Plan:%20Test%20Plan%20for%2020100818%20(1)

this will redirect to a Ticket edit page, with the Test Case in Test Plan hyperlink in the description (as Wiki page references). You can simply post the form to create the Ticket.