Changes between Version 2 and Version 3 of TestManagerForTracPluginRestfulApi
- Timestamp:
- Jun 12, 2015, 11:46:17 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TestManagerForTracPluginRestfulApi
v2 v3 1 1 ''' [ [wiki:TestManagerForTracPlugin Home] | [wiki:TestManagerForTracPluginChangeHistory Latest changes] | [wiki:TestManagerForTracPluginGallery Image gallery] | [http://www.youtube.com/watch?v=BIi3QMT0rT4 Video tutorial on Youtube] | [wiki:TestManagerForTracPluginQuickSetup Quick setup guide] | [http://sourceforge.net/projects/testman4trac Download] | [http://sourceforge.net/projects/testman4trac/files Source] | [wiki:TestManagerForTracPluginBugsFeatures Bugs/Feature requests] ]''' 2 2 3 = Test Manager for Trac Plugin - The HTTP RESTful API =3 = Test Manager for Trac Plugin - The HTTP RESTful API 4 4 5 [[BR]]6 5 The [wiki:TestManagerForTracPlugin TestManager plugin] can be used programmatically to create and manage Test Catalogs, Test Cases and Test Plans, and to set the test execution verdicts of Test Cases in a plan. 7 6 8 7 This page describes the '''HTTP RESTful API''', but there are alternatives: 9 8 10 * An '''XML-RPC''' API, allowing you to remotely control your test artifacts using a standard protocol ,9 * An '''XML-RPC''' API, allowing you to remotely control your test artifacts using a standard protocol. 11 10 * A '''Python''' API, allowing for a fine-grained control over any artifact, managing their life-cycle, listening to events, reacting to status changes and workflow transitions. 12 13 [[BR]]14 In the following, because of the spam filter not allowing more than a few URLs in a page, I have replaced:15 11 16 {{{ 17 http://yourserver/yourproject 18 }}} 19 20 with: 21 22 {{{ 23 <yourserver/yourproject> 24 }}} 25 26 == Working with Test Catalogs and Test Cases == 12 == Working with Test Catalogs and Test Cases 27 13 28 14 You can create test catalogs and cases programmatically by means of the following http requests. 29 15 30 31 === Create a root test catalog === 16 === Create a root test catalog 32 17 33 18 Get the following URL: … … 35 20 <yourserver/yourproject>/testcreate?type=catalog&path=TC&title=My%20new%20catalog 36 21 }}} 37 this will assign a unique ID (the number 0 in the URL below) to the new catalog, create the corresponding Wiki page and redirect to it. You may discard the response if you don't need to know the catalog ID (last number in the URL): 22 23 This will assign a unique ID (the number 0 in the URL below) to the new catalog, create the corresponding Wiki page and redirect to it. You may discard the response if you don't need to know the catalog ID (last number in the URL): 38 24 39 25 {{{ … … 41 27 }}} 42 28 43 === Create a sub-catalog ===29 === Create a sub-catalog 44 30 45 Get the wollowing URL, where "path" is the name of the parent catalog.31 Get the following URL, where "path" is the name of the parent catalog. 46 32 33 {{{ 47 34 <yourserver/yourproject>/testcreate?type=catalog&path=TC_TT0&title=My%20sub%20catalog 48 this will assign a unique ID (the number 1 in the URL below) to the new catalog, create the corresponding Wiki page and redirect to it. You may discard the response if you don't need to know the catalog ID (last number in the URL): 35 }}} 36 37 This will assign a unique ID (the number 1 in the URL below) to the new catalog, create the corresponding Wiki page and redirect to it. You may discard the response if you don't need to know the catalog ID (last number in the URL): 49 38 50 39 {{{ … … 52 41 }}} 53 42 54 === Create a Test Case ===43 === Create a Test Case 55 44 56 Get the following URL, where "path" is the name of the parent (sub-)catalog .45 Get the following URL, where "path" is the name of the parent (sub-)catalog: 57 46 58 47 {{{ … … 60 49 }}} 61 50 62 this will assign a unique ID (the number 0 in the URL below) to the new test case, create the corresponding Wiki page and redirect to it. You may discard the response if you don't need to know the test case ID (last number in the URL):51 This will assign a unique ID (the number 0 in the URL below) to the new test case, create the corresponding Wiki page and redirect to it. You may discard the response if you don't need to know the test case ID (last number in the URL): 63 52 64 53 {{{ … … 66 55 }}} 67 56 68 69 == Working with Test Plans and setting the status of a Test Case == 57 == Working with Test Plans and setting the status of a Test Case 70 58 71 59 You can also create a new Test Plan (e.g. for each nightly build) programmatically as follows. 72 60 73 74 === Create a Test Plan from a specific catalog === 61 === Create a Test Plan from a specific catalog 75 62 76 63 Get the following URL, where "path" is the name of the (sub-)catalog to create the test plan against. … … 80 67 }}} 81 68 82 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: You may discard the response if you don't need to know the plan ID (planid parameter in the URL):69 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: You may discard the response if you don't need to know the plan ID (planid parameter in the URL): 83 70 84 71 {{{ … … 88 75 The Test Plan will contain all of the test cases in the specified catalog, with a status of "Untested". 89 76 90 Note: As you can notice, you can always pass from a test catalog to one of its test plans by adding the "planid=<plan id>" parameter to the test catalog URL. The same also stands for test cases. You can pass to a test case in a particular plan by adding the planid parameter to its URL.77 '''Note''': You can always pass from a test catalog to one of its test plans by adding the "planid=<plan id>" parameter to the test catalog URL. The same also stands for test cases. You can pass to a test case in a particular plan by adding the planid parameter to its URL. 91 78 79 === Set a Test Case execution verdict, in the context of a Test Plan 92 80 93 94 === Set a Test Case execution verdict, in the context of a Test Plan === 95 96 Then, you can set the verdict for any test case in the plan, by means of the following. 97 98 Get the following URL, where "id" is the Test Case ID and planid is the Test Plan ID: 81 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: 99 82 100 83 {{{ … … 108 91 * FAILED 109 92 110 111 == Change a [custom] property of any test object == 93 == Change a [custom] property of any test object 112 94 113 95 Any property, either standard or custom, of any test object can be set programmatically through the RESTful API. 114 96 115 A test object is identified by its realm (i .e. type) and its key (i.e. in most cases the ID, for test cases in the context of a plan, also the plan ID is required).97 A test object is identified by its realm (ie type) and its key, ie in most cases the ID, for test cases in the context of a plan, also the plan ID is required. 116 98 117 99 The realms that identify the test objects are the following: … … 133 115 The key properties are provided to the property update service through the "key" parameter, in the form of a dictionary. 134 116 135 The next things to pass to the service are the name of the property to modify and the new value. Guess what... you use the "name" and "value" parameters, respectively. 136 137 For example, to change a Test Case - with ID 5 - custom property "platform" (which has been previously added to the test case type in the trac.ini file) to the new value "Windows", this is the URL to GET: 117 The next things to pass to the service are the name of the property to modify and the new value. Use the "name" and "value" parameters, respectively. For example, to change a Test Case - with ID 5 - custom property "platform" (which has previously been added to the test case type in the `trac.ini` file) to the new value "Windows", this is the URL to GET: 138 118 139 119 {{{ … … 141 121 }}} 142 122 143 == Traceability between Test Cases and Tickets ==123 == Traceability between Test Cases and Tickets 144 124 145 You can open a Ticket and have a traceback to the (e .g.failed) Test Case as follows.125 You can open a Ticket and have a traceback to the (eg failed) Test Case as follows. 146 126 147 148 === Open a Ticket on a Test Case === 127 === Open a Ticket on a Test Case 149 128 150 129 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: … … 154 133 }}} 155 134 156 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. 157 135 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.