qase-robotframework 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ ============
2
+ Contributors
3
+ ============
4
+
5
+ * Parviz Khavari <csctclan@gmail.com>
6
+ * Nikita Fedorov <nik333r@gmail.com>
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2019 Qase TMS
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,332 @@
1
+ Metadata-Version: 2.1
2
+ Name: qase-robotframework
3
+ Version: 2.0.1
4
+ Summary: Qase Robot Framework Plugin
5
+ Author-email: Qase Team <support@qase.io>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "[]"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright 2019 Qase TMS
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+
208
+ Project-URL: Homepage, https://github.com/qase-tms/qase-python/tree/master/qase-robotframework
209
+ Classifier: Development Status :: 5 - Production/Stable
210
+ Classifier: Framework :: Robot Framework
211
+ Classifier: Programming Language :: Python
212
+ Requires-Python: >=3.8
213
+ Description-Content-Type: text/markdown
214
+ License-File: LICENSE
215
+ License-File: AUTHORS.rst
216
+ Requires-Dist: qase-python-commons <2.0.0,>=1.0.4
217
+ Provides-Extra: testing
218
+ Requires-Dist: pytest ; extra == 'testing'
219
+ Requires-Dist: pytest-cov ; extra == 'testing'
220
+
221
+ > # Qase Robot Framework Listener
222
+ >
223
+ > Publish results simple and easy.
224
+
225
+ ## How to integrate
226
+
227
+ ```
228
+ pip install qase-robotframework
229
+ ```
230
+
231
+ ## Usage
232
+
233
+ If you want to create a persistent link to Test Cases in Qase, you should add Qase test case IDs to robot framework tests.
234
+ They should be added as a tags in form like `Q-<case id without project code>`. You can use upper and lower case to indicate the test case IDs. Example:
235
+
236
+ ```robotframework
237
+ *** Test Cases ***
238
+ Push button
239
+ [Tags] q-2
240
+ Push button 1
241
+ Result should be 1
242
+
243
+ Push multiple buttons
244
+ [Tags] Q-3
245
+ Push button 1
246
+ Push button 2
247
+ Result should be 12
248
+ ```
249
+
250
+ ```robotframework
251
+ *** Test Cases *** Expression Expected
252
+ Addition 12 + 2 + 2 16
253
+ 2 + -3 -1
254
+ [Tags] Q-7
255
+
256
+ Subtraction 12 - 2 - 2 8
257
+ 2 - -3 5
258
+ [Tags] Q-8
259
+ ```
260
+
261
+ ### Working with steps
262
+
263
+ Listener supports reporting steps results:
264
+
265
+ Example:
266
+ ```robotframework
267
+ Quick Get A JSON Body Test ## Test case: "Quick Get A JSON Body Test"
268
+ [Tags] Q-3
269
+ ${response}= GET https://jsonplaceholder.typicode.com/posts/1 ## 1-st step - "GET"
270
+ Should Be Equal As Strings 1 ${response.json()}[id] ## 2-nd step - "Should Be Equal As Strings"
271
+
272
+ Initializing the test case ## Test case: "Initializing the test case"
273
+ [Tags] q-4
274
+ Set To Dictionary ${info} field1=A sample string ## 1-st step - "Set To Dictionary"
275
+ ```
276
+
277
+ ## Configuration
278
+
279
+ Listener supports loading configuration both from environment variables and from `tox.ini` file.
280
+
281
+ ENV variables:
282
+ - `QASE_MODE` - Define mode: `testops` to enable report
283
+ - `QASE_ENVIRONMENT` - Environment ID for the run
284
+ - `QASE_DEBUG` - If passed something - will enable debug logging for listener. Default: `False`
285
+ - `QASE_TESTOPS_MODE` - You can switch between `sync` and `async` modes. Default is `async`
286
+ - `QASE_TESTOPS_API_TOKEN` - API token to access Qase TestOps
287
+ - `QASE_TESTOPS_PROJECT` - Project code from Qase TestOps
288
+ - `QASE_TESTOPS_PLAN_ID` - Plan ID if you want to add results to existing run from Test Plan
289
+ - `QASE_TESTOPS_RUN_ID` - Run ID if you want to add results to existing run
290
+ - `QASE_TESTOPS_RUN_TITLE` - Set custom run name when no run ID is provided
291
+ - `QASE_TESTOPS_COMPLETE_RUN` - Will complete run after all tests are finished. Default: `False`
292
+ - `QASE_TESTOPS_HOST` - Define a host for Qase TestOps. Default: `qase.io`
293
+ ### Usage:
294
+ ```
295
+ QASE_API_TOKEN=<API TOKEN> QASE_PROJECT=PRJCODE robot --listener qaseio.robotframework.Listener keyword_driven.robot data_driven.robot
296
+ ```
297
+ Moving variables to `tox.ini`, example configuration:
298
+ ```ini
299
+ [qase]
300
+ qase_testops_api_token=api_key
301
+ qase_testops_project=project_code
302
+ qase_testops_run_id=run_id
303
+ qase_testops_run_title=New Robot Framework Run
304
+ qase_debug=True
305
+ qase_testops_complete_run=True
306
+ ```
307
+ Execution:
308
+ ```
309
+ robot --listener qaseio.robotframework.Listener someTest.robot
310
+ ```
311
+ ## Contribution
312
+
313
+ Install project locally:
314
+
315
+ ```bash
316
+ python3 -m venv .venv
317
+ source .venv/bin/activate
318
+ pip install -e .[testing]
319
+ ```
320
+
321
+ Install dev requirements:
322
+
323
+ ```bash
324
+ pip install pre-commit
325
+ pre-commit install
326
+ ```
327
+
328
+ Test project:
329
+
330
+ ```bash
331
+ tox
332
+ ```
@@ -0,0 +1,10 @@
1
+ qaseio/robotframework/__init__.py,sha256=c-2wRxqBi0y-9MiG0QGWkJ-rIeNko051xifyWRZmqu4,55
2
+ qaseio/robotframework/listener.py,sha256=C2EXjp16prGj3V0JgCi4BdaFYIbX16yZvbzm8Z6Zq_s,5768
3
+ qaseio/robotframework/models.py,sha256=GH9gS9A8YL4YJrmMJoTaFq6TH6W_alLgPbwgGCfmFzQ,1430
4
+ qaseio/robotframework/types.py,sha256=v2hJ_d5_HkoGVKc3XKpbbkzhW6zSeB2LJZ9SJ_pX1T8,665
5
+ qase_robotframework-2.0.1.dist-info/AUTHORS.rst,sha256=ovfDvPiIQMIDiAlkvF0ccfGNCD_MVUKIu1VYPlBU54Q,115
6
+ qase_robotframework-2.0.1.dist-info/LICENSE,sha256=VzCH_PocWanN68XZU3ugW81fBEP7jdU_mCSDpaIv-oY,11338
7
+ qase_robotframework-2.0.1.dist-info/METADATA,sha256=hsMFyRT5UzXAKQO_QZ_xs1Dt6shbkAVH6FfGwkUZgNA,16877
8
+ qase_robotframework-2.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
9
+ qase_robotframework-2.0.1.dist-info/top_level.txt,sha256=keRvf1O-Wqp_5utcMOmxaX_kLGqHnuamAY58LtJywl8,7
10
+ qase_robotframework-2.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.43.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ qaseio
@@ -0,0 +1,3 @@
1
+ from .listener import Listener
2
+
3
+ __all__ = ["Listener"]
@@ -0,0 +1,165 @@
1
+ import configparser
2
+ import logging
3
+ import os
4
+ import re
5
+ import uuid
6
+ import time
7
+ from datetime import datetime
8
+
9
+ from qaseio.commons import QaseTestOps
10
+ from qaseio.commons import QaseUtils
11
+ from qaseio.commons import QaseReport
12
+ from .types import Envs, STATUSES
13
+ from .models import *
14
+
15
+ logger = logging.getLogger("qase-robotframework")
16
+
17
+
18
+ class Listener:
19
+ ROBOT_LISTENER_API_VERSION = 2
20
+
21
+ def __init__(self):
22
+ self.config = configparser.ConfigParser()
23
+ self.config.read("tox.ini")
24
+
25
+ if self._get_param(Envs.MODE) and self._get_param(Envs.MODE).lower() == 'testops':
26
+ token = self._get_param(Envs.TESTOPS_API_TOKEN)
27
+ project_code = self._get_param(Envs.TESTOPS_PROJECT)
28
+
29
+ if not token or not project_code:
30
+ raise ValueError("Token and Project code should be provided")
31
+
32
+ run_title = "Automated Run {}".format(str(datetime.now()))
33
+ if self._get_param(Envs.TESTOPS_RUN_TITLE, None):
34
+ run_title = self._get_param(Envs.TESTOPS_RUN_TITLE, None)
35
+
36
+ self.reporter = QaseTestOps(
37
+ api_token=token,
38
+ project_code=project_code,
39
+ run_id=self._get_param(Envs.TESTOPS_RUN_ID, None),
40
+ plan_id=self._get_param(Envs.TESTOPS_PLAN_ID, None),
41
+ complete_run=self._get_param(Envs.TESTOPS_COMPLETE_RUN).lower() in ['true', '1'],
42
+ mode=self._get_param(Envs.TESTOPS_MODE, 'async'),
43
+ run_title=run_title,
44
+ host=self._get_param(Envs.TESTOPS_HOST, 'qase.io'),
45
+ environment=self._get_param(Envs.ENVIRONMENT, None)
46
+ )
47
+ else:
48
+ self.reporter = QaseReport(
49
+ report_path=self._get_param(Envs.REPORT_PATH, 'build/qase-report'),
50
+ )
51
+
52
+ self.result = {}
53
+ self.steps = {}
54
+ self.step_uuid = None
55
+ self.suite = {}
56
+
57
+ self.debug = self._get_param(Envs.DEBUG) and self._get_param(Envs.DEBUG).lower() in ['true', '1']
58
+ if self.debug:
59
+ logger.setLevel(logging.DEBUG)
60
+ ch = logging.StreamHandler()
61
+ formatter = logging.Formatter(
62
+ "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
63
+ )
64
+ ch.setFormatter(formatter)
65
+ logger.addHandler(ch)
66
+
67
+ self.reporter.start_run()
68
+
69
+ def _get_param(self, param: Envs, default=None):
70
+ param: str = param.value
71
+ return os.environ.get(
72
+ param, self.config.get("qase", param.lower(), fallback=default)
73
+ )
74
+
75
+ def start_suite(self, name, attributes):
76
+ self.suite = {
77
+ "title": name,
78
+ "description": attributes["doc"]
79
+ }
80
+ logger.debug("Starting suite '%s'", name)
81
+
82
+ def start_test(self, name, attributes: StartTestModel):
83
+ logger.debug("Starting test '%s'", name)
84
+
85
+ self.result = {
86
+ 'is_api_result': True,
87
+ 'case': {},
88
+ 'steps': {},
89
+ 'param': {},
90
+ }
91
+ self.result['uuid'] = str(uuid.uuid4())
92
+ self.result["started_at"] = time.time()
93
+
94
+ case_id = self._extract_ids(attributes.get("tags"))
95
+ if case_id:
96
+ self.result["case_id"] = int(case_id)
97
+
98
+ def end_test(self, name, attributes: EndTestModel):
99
+ logger.debug("Finishing test '%s'", name)
100
+
101
+ completed_at = time.time()
102
+ self.result['time_ms'] = int((completed_at - self.result.get("started_at")) * 1000)
103
+ self.result['completed_at'] = completed_at
104
+ self.result['status'] = STATUSES[attributes.get("status")]
105
+ self.result['stacktrace'] = attributes.get("message")
106
+ self.result['case'] = {}
107
+ self.result['case']['title'] = name
108
+ self.result['case']['description'] = attributes.get("doc")
109
+ if self.suite:
110
+ self.result['case']['suite_title'] = self.suite.get('title', None)
111
+ # self.result['case']['suite_description'] = self.suite.get('description', None) // Not support in Qase API yet
112
+
113
+ self.reporter.add_result(self.result, QaseUtils().build_tree(self.steps))
114
+
115
+ self.result = {}
116
+ self.steps = {}
117
+ self.step_uuid = None
118
+
119
+ logger.info(
120
+ "Finished case result: %s, error: %s",
121
+ attributes.get("status"),
122
+ attributes.get("message"),
123
+ )
124
+
125
+ def start_keyword(self, name, attributes):
126
+ id = str(uuid.uuid4())
127
+
128
+ self.steps[id] = {
129
+ "uuid": id,
130
+ "started_at": time.time(),
131
+ "attachments": [],
132
+ "steps": {},
133
+ "parent_id": self.step_uuid
134
+ }
135
+
136
+ self.step_uuid = id
137
+
138
+ def end_keyword(self, name, attributes):
139
+ now = time.time()
140
+
141
+ self.steps[self.step_uuid]['status'] = STATUSES[attributes["status"]]
142
+ self.steps[self.step_uuid]['action'] = attributes["kwname"]
143
+ self.steps[self.step_uuid]['duration'] = int((now - self.steps[self.step_uuid]['started_at']) * 1000)
144
+ self.steps[self.step_uuid]['completed_at'] = now
145
+ self.steps[self.step_uuid]['comment'] = f"Step `{name}` with args: {attributes['args']}"
146
+
147
+ self.step_uuid = self.steps[self.step_uuid]['parent_id']
148
+
149
+ def end_suite(self, name, attributes: EndSuiteModel):
150
+ self.suite = {}
151
+ logger.debug("Finishing suite '%s'", name)
152
+
153
+ def close(self):
154
+ logger.info("complete run executing")
155
+ self.reporter.complete_run(True)
156
+
157
+ def log_message(self, message):
158
+ logger.debug("Log:", message)
159
+
160
+ def _extract_ids(self, list_of_tags: List[str]):
161
+ id = re.compile(r"Q-(\d+)", re.IGNORECASE)
162
+ for tag in list_of_tags:
163
+ if id.fullmatch(tag):
164
+ return int(id.match(tag).groups()[0])
165
+ return None
@@ -0,0 +1,86 @@
1
+ import sys
2
+ from typing import List
3
+
4
+ if sys.version_info >= (3, 8):
5
+ from typing import TypedDict
6
+ else:
7
+ from typing import Dict as TypedDict
8
+
9
+
10
+ class StartSuiteModel(TypedDict):
11
+ id: str
12
+ longname: str
13
+ doc: str
14
+ metadata: dict
15
+ source: str
16
+ suites: List[str]
17
+ tests: List[str]
18
+ totaltests: int
19
+ starttime: str
20
+
21
+
22
+ class EndSuiteModel(TypedDict):
23
+ id: str
24
+ longname: str
25
+ doc: str
26
+ metadata: dict
27
+ source: str
28
+ starttime: str
29
+ endtime: str
30
+ elapsedtime: int
31
+ status: str
32
+ statistics: str
33
+ message: str
34
+
35
+
36
+ class StartTestModel(TypedDict):
37
+ id: str
38
+ longname: str
39
+ originalname: str
40
+ doc: dict
41
+ tags: List[str]
42
+ critical: str
43
+ template: str
44
+ lineno: int
45
+ starttime: str
46
+
47
+
48
+ class EndTestModel(TypedDict):
49
+ id: str
50
+ longname: str
51
+ originalname: str
52
+ doc: dict
53
+ tags: List[str]
54
+ critical: str
55
+ template: str
56
+ lineno: int
57
+ starttime: str
58
+ endtime: str
59
+ elapsedtime: int
60
+ status: str
61
+ message: str
62
+
63
+
64
+ class StartKeywordModel(TypedDict):
65
+ type: str
66
+ kwname: str
67
+ libname: str
68
+ doc: dict
69
+ args: List[str]
70
+ assign: List[str]
71
+ tags: List[str]
72
+ starttime: str
73
+
74
+
75
+ class EndKeywordModel(TypedDict):
76
+ type: str
77
+ kwname: str
78
+ libname: str
79
+ doc: dict
80
+ args: List[str]
81
+ assign: List[str]
82
+ tags: List[str]
83
+ starttime: str
84
+ endtime: str
85
+ elapsedtime: int
86
+ status: str
@@ -0,0 +1,27 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Envs(Enum):
5
+ DEBUG = "QASE_DEBUG"
6
+ MODE = "QASE_MODE"
7
+ ENVIRONMENT = "QASE_ENVIRONMENT"
8
+
9
+ TESTOPS_MODE = "QASE_TESTOPS_MODE"
10
+ TESTOPS_HOST = "QASE_TESTOPS_HOST"
11
+ TESTOPS_API_TOKEN = "QASE_TESTOPS_API_TOKEN"
12
+ TESTOPS_PROJECT = "QASE_TESTOPS_PROJECT"
13
+ TESTOPS_RUN_ID = "QASE_TESTOPS_RUN_ID"
14
+ TESTOPS_PLAN_ID = "QASE_TESTOPS_PLAN_ID"
15
+ TESTOPS_RUN_TITLE = "QASE_TESTOPS_RUN_TITLE"
16
+ TESTOPS_COMPLETE_RUN = "QASE_TESTOPS_COMPLETE_RUN"
17
+
18
+ REPORT_PATH = "QASE_REPORT_PATH"
19
+
20
+
21
+ STATUSES = {
22
+ "PASS": "passed",
23
+ "FAIL": "failed",
24
+ "SKIP": "skipped",
25
+ "NOT RUN": "skipped",
26
+ "NOT_SET": "skipped"
27
+ }