|
1 | 1 | #! /usr/bin/python
|
2 | 2 | # -*- coding: UTF-8 -*-
|
3 | 3 |
|
4 |
| -# Copyright 2011-2012 Olivier Renault, TestLink-API-Python-client developers |
| 4 | +# Copyright 2011-2013 Olivier Renault, TestLink-API-Python-client developers |
5 | 5 | #
|
6 | 6 | # Licensed under the Apache License, Version 2.0 (the "License");
|
7 | 7 | # you may not use this file except in compliance with the License.
|
|
45 | 45 | --------- Test Case B
|
46 | 46 | |
|
47 | 47 | --- 5 automated test steps
|
| 48 | + |
| 49 | +Update 12. Oct. 2013, L. Czub |
| 50 | +Integrates v0.4.5 changes for optional arguments |
| 51 | +The v0.4.0 method calls are still visible as comments (look for CHANGE v0.4.5) |
| 52 | +So this file helps to understand where existing own code needs adjustment. |
| 53 | +- |
| 54 | +used as behaviour is still |
48 | 55 | """
|
49 | 56 | from testlink import TestlinkAPIClient, TestLinkHelper
|
50 | 57 | import sys
|
|
90 | 97 | print ""
|
91 | 98 |
|
92 | 99 | # Creates the project
|
| 100 | + |
| 101 | +# -- Start CHANGE v0.4.5 -- |
| 102 | +# newProject = myTestLink.createTestProject(NEWPROJECT, "NPROAPI", |
| 103 | +# "notes=This is a Project created with the API", "active=1", "public=1", |
| 104 | +# "options=requirementsEnabled:0,testPriorityEnabled:1,automationEnabled:1,inventoryEnabled:0") |
93 | 105 | newProject = myTestLink.createTestProject(NEWPROJECT, "NPROAPI",
|
94 |
| -"notes=This is a Project created with the API", "active=1", "public=1", |
95 |
| -"options=requirementsEnabled:0,testPriorityEnabled:1,automationEnabled:1,inventoryEnabled:0") |
| 106 | + notes='This is a Project created with the API', active=1, public=1, |
| 107 | + options={'requirementsEnabled' : 0, 'testPriorityEnabled' : 1, |
| 108 | + 'automationEnabled' : 1, 'inventoryEnabled' : 0}) |
| 109 | +# -- END CHANGE v0.4.5 -- |
96 | 110 | isOk = newProject[0]['message']
|
97 | 111 | if isOk=="Success!":
|
98 | 112 | newProjectID = newProject[0]['id']
|
|
102 | 116 | sys.exit(-1)
|
103 | 117 |
|
104 | 118 | # Creates the test plan
|
| 119 | +# -- Start CHANGE v0.4.5 -- |
| 120 | +# newTestPlan = myTestLink.createTestPlan(NEWTESTPLAN, NEWPROJECT, |
| 121 | +# "notes=New TestPlan created with the API","active=1", "public=1") |
105 | 122 | newTestPlan = myTestLink.createTestPlan(NEWTESTPLAN, NEWPROJECT,
|
106 |
| - "notes=New TestPlan created with the API","active=1", "public=1") |
| 123 | + notes='New TestPlan created with the API',active=1, public=1) |
| 124 | +# -- END CHANGE v0.4.5 -- |
107 | 125 | isOk = newTestPlan[0]['message']
|
108 | 126 | if isOk=="Success!":
|
109 | 127 | newTestPlanID = newTestPlan[0]['id']
|
|
137 | 155 | sys.exit(-1)
|
138 | 156 |
|
139 | 157 | #Creates the test Suite AA
|
| 158 | +# -- Start CHANGE v0.4.5 -- |
| 159 | +# newTestSuite = myTestLink.createTestSuite(newProjectID, NEWTESTSUITE_AA, |
| 160 | +# "Details of the Test Suite AA","parentid="+FirstLevelID) |
140 | 161 | newTestSuite = myTestLink.createTestSuite(newProjectID, NEWTESTSUITE_AA,
|
141 |
| - "Details of the Test Suite AA","parentid="+FirstLevelID) |
| 162 | + "Details of the Test Suite AA",parentid=FirstLevelID) |
| 163 | +# -- END CHANGE v0.4.5 -- |
142 | 164 | isOk = newTestSuite[0]['message']
|
143 | 165 | if isOk=="ok":
|
144 | 166 | TestSuiteID_AA = newTestSuite[0]['id']
|
|
157 | 179 | myTestLink.appendStep("Step action 4", "Step result 4", MANUAL)
|
158 | 180 | myTestLink.appendStep("Step action 5", "Step result 5", MANUAL)
|
159 | 181 |
|
| 182 | +# -- Start CHANGE v0.4.5 -- |
| 183 | +# newTestCase = myTestLink.createTestCase(NEWTESTCASE_AA, TestSuiteID_AA, |
| 184 | +# newProjectID, "admin", "This is the summary of the Test Case AA", |
| 185 | +# "preconditions=these are the preconditions") |
160 | 186 | newTestCase = myTestLink.createTestCase(NEWTESTCASE_AA, TestSuiteID_AA,
|
161 | 187 | newProjectID, "admin", "This is the summary of the Test Case AA",
|
162 |
| - "preconditions=these are the preconditions") |
| 188 | + preconditions='these are the preconditions') |
| 189 | +# -- END CHANGE v0.4.5 -- |
163 | 190 | isOk = newTestCase[0]['message']
|
164 | 191 | if isOk=="Success!":
|
165 |
| - newTestCaseID = newTestCase[0]['id'] |
166 |
| - print "New Test Case '%s' - id: %s" % (NEWTESTCASE_AA, newTestCaseID) |
| 192 | + newTestCaseID_AA = newTestCase[0]['id'] |
| 193 | + print "New Test Case '%s' - id: %s" % (NEWTESTCASE_AA, newTestCaseID_AA) |
167 | 194 | else:
|
168 | 195 | print "Error creating the Test Case '%s': %s " % (NEWTESTCASE_AA, isOk)
|
169 | 196 | sys.exit(-1)
|
|
175 | 202 | myTestLink.appendStep("Step action 4", "Step result 4", AUTOMATED)
|
176 | 203 | myTestLink.appendStep("Step action 5", "Step result 5", AUTOMATED)
|
177 | 204 |
|
| 205 | +# -- Start CHANGE v0.4.5 -- |
| 206 | +# newTestCase = myTestLink.createTestCase(NEWTESTCASE_B, TestSuiteID_B, |
| 207 | +# newProjectID, "admin", "This is the summary of the Test Case B", |
| 208 | +# "preconditions=these are the preconditions", |
| 209 | +# "executiontype=%i" % AUTOMATED) |
178 | 210 | newTestCase = myTestLink.createTestCase(NEWTESTCASE_B, TestSuiteID_B,
|
179 | 211 | newProjectID, "admin", "This is the summary of the Test Case B",
|
180 |
| - "preconditions=these are the preconditions", |
181 |
| - "executiontype=%i" % AUTOMATED) |
| 212 | + preconditions='these are the preconditions', executiontype=AUTOMATED) |
| 213 | +# -- END CHANGE v0.4.5 -- |
182 | 214 | isOk = newTestCase[0]['message']
|
183 | 215 | if isOk=="Success!":
|
184 |
| - newTestCaseID = newTestCase[0]['id'] |
185 |
| - print "New Test Case '%s' - id: %s" % (NEWTESTCASE_B, newTestCaseID) |
| 216 | + newTestCaseID_B = newTestCase[0]['id'] |
| 217 | + print "New Test Case '%s' - id: %s" % (NEWTESTCASE_B, newTestCaseID_B) |
186 | 218 | else:
|
187 | 219 | print "Error creating the Test Case '%s': %s " % (NEWTESTCASE_B, isOk)
|
188 | 220 | sys.exit(-1)
|
| 221 | + |
| 222 | +# -- New Examples with v0.4.5 -- |
| 223 | + |
| 224 | +# Add test cases to test plan - we need the full external id ! |
| 225 | +tc_aa_full_ext_id = myTestLink.getTestCase(newTestCaseID_AA)[0]['full_tc_external_id'] |
| 226 | +response = myTestLink._callServer('addTestCaseToTestPlan', |
| 227 | + {'devKey' : myTestLink.devKey, |
| 228 | + 'testprojectid' : newProjectID, |
| 229 | + 'testplanid' : newTestPlanID, |
| 230 | + 'testcaseexternalid' : tc_aa_full_ext_id, 'version' : 1}) |
| 231 | +print response |
| 232 | +tc_b_full_ext_id = myTestLink.getTestCase(testcaseid=newTestCaseID_B)[0]['full_tc_external_id'] |
| 233 | +response = myTestLink._callServer('addTestCaseToTestPlan', |
| 234 | + {'devKey' : myTestLink.devKey, |
| 235 | + 'testprojectid' : newProjectID, |
| 236 | + 'testplanid' : newTestPlanID, |
| 237 | + 'testcaseexternalid' : tc_b_full_ext_id, 'version' : 1}) |
| 238 | +print response |
| 239 | + |
189 | 240 |
|
190 | 241 | print ""
|
191 | 242 | print "Number of Projects in TestLink: %s " % (myTestLink.countProjects(),)
|
|
0 commit comments