testit-adapter-pytest 4.2.8__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,309 @@
1
+ Metadata-Version: 2.4
2
+ Name: testit-adapter-pytest
3
+ Version: 4.2.8
4
+ Summary: Pytest adapter for Test IT
5
+ Home-page: https://github.com/testit-tms/adapters-python/
6
+ Author: Integration team
7
+ Author-email: integrations@testit.software
8
+ License: Apache-2.0
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: pytest
17
+ Requires-Dist: pytest-xdist
18
+ Requires-Dist: attrs
19
+ Requires-Dist: testit-python-commons==4.2.8
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: license
27
+ Dynamic: requires-dist
28
+ Dynamic: summary
29
+
30
+ # Test IT TMS adapter for Pytest
31
+
32
+ ![Test IT](https://raw.githubusercontent.com/testit-tms/adapters-python/master/images/banner.png)
33
+
34
+ [![Release
35
+ Status](https://img.shields.io/pypi/v/testit-adapter-pytest?style=plastic)](https://pypi.python.org/pypi/testit-adapter-pytest)
36
+ [![Downloads](https://img.shields.io/pypi/dm/testit-adapter-pytest?style=plastic)](https://pypi.python.org/pypi/testit-adapter-pytest)
37
+ [![GitHub contributors](https://img.shields.io/github/contributors/testit-tms/adapters-python?style=plastic)](https://github.com/testit-tms/adapters-python)
38
+
39
+ ## Getting Started
40
+
41
+ ### Installation
42
+
43
+ ```
44
+ pip install testit-adapter-pytest
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ### Configuration
50
+
51
+ | Description | File property | Environment variable | CLI argument |
52
+ |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|--------------------------------------------|--------------------------------------|
53
+ | Location of the TMS instance | url | TMS_URL | tmsUrl |
54
+ | API secret key [How to getting API secret key?](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) | privateToken | TMS_PRIVATE_TOKEN | tmsPrivateToken |
55
+ | ID of project in TMS instance [How to getting project ID?](https://github.com/testit-tms/.github/tree/main/configuration#projectid) | projectId | TMS_PROJECT_ID | tmsProjectId |
56
+ | ID of configuration in TMS instance [How to getting configuration ID?](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) | configurationId | TMS_CONFIGURATION_ID | tmsConfigurationId |
57
+ | ID of the created test run in TMS instance.<br/>It's necessary for **adapterMode** 0 or 1 | testRunId | TMS_TEST_RUN_ID | tmsTestRunId |
58
+ | Parameter for specifying the name of test run in TMS instance (**It's optional**). If it is not provided, it is created automatically | testRunName | TMS_TEST_RUN_NAME | tmsTestRunName |
59
+ | Adapter mode. Default value - 0. The adapter supports following modes:<br/>0 - in this mode, the adapter filters tests by test run ID and configuration ID, and sends the results to the test run<br/>1 - in this mode, the adapter sends all results to the test run without filtering or [with filtering CLI](#run-with-filter)<br/>2 - in this mode, the adapter creates a new test run and sends results to the new test run | adapterMode | TMS_ADAPTER_MODE | tmsAdapterMode |
60
+ | It enables/disables certificate validation (**It's optional**). Default value - true | certValidation | TMS_CERT_VALIDATION | tmsCertValidation |
61
+ | Mode of automatic creation test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest)<br/>false - in this mode, the adapter will not create a test case | automaticCreationTestCases | TMS_AUTOMATIC_CREATION_TEST_CASES | tmsAutomaticCreationTestCases |
62
+ | Mode of automatic updation links to test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will update links to test cases<br/>false - in this mode, the adapter will not update link to test cases | automaticUpdationLinksToTestCases | TMS_AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES | tmsAutomaticUpdationLinksToTestCases |
63
+ | Mode of import type selection when launching autotests (**It's optional**). Default value - true. The adapter supports following modes:<br/>true - in this mode, the adapter will create/update each autotest in real time<br/>false - in this mode, the adapter will create/update multiple autotests | importRealtime | TMS_IMPORT_REALTIME | tmsImportRealtime |
64
+ | Url of proxy server (**It's optional**) | tmsProxy | TMS_PROXY | tmsProxy |
65
+ | Name (**including extension**) of the configuration file If it is not provided, it is used default file name (**It's optional**) | - | TMS_CONFIG_FILE | tmsConfigFile |
66
+ | Sync storage port (**It's optional, 49152 by default**) | syncStoragePort | TMS_SYNC_STORAGE_PORT | syncStoragePort |
67
+
68
+ #### File
69
+
70
+ Add `[testit]` block to your **pyproject.toml** or create **connection_config.ini** file in the root directory of the project:
71
+ ```
72
+ [testit]
73
+ URL = URL
74
+ privateToken = USER_PRIVATE_TOKEN
75
+ projectId = PROJECT_ID
76
+ configurationId = CONFIGURATION_ID
77
+ testRunId = TEST_RUN_ID
78
+ testRunName = TEST_RUN_NAME
79
+ adapterMode = ADAPTER_MODE
80
+ certValidation = CERT_VALIDATION
81
+ automaticCreationTestCases = AUTOMATIC_CREATION_TEST_CASES
82
+ automaticUpdationLinksToTestCases = AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES
83
+ importRealtime = IMPORT_REALTIME
84
+
85
+ # This section are optional. It enables debug mode.
86
+ [debug]
87
+ tmsProxy = TMS_PROXY
88
+ ```
89
+
90
+ #### Examples
91
+
92
+ Launch with a `pyproject.toml` or `connection_config.ini` file in the root directory of the project:
93
+
94
+ ```
95
+ $ pytest --testit
96
+ ```
97
+
98
+ Enable debug logs:
99
+
100
+ ```
101
+ $ pytest --testit --log-cli-level=DEBUG
102
+ ```
103
+
104
+ Launch with command-line parameters:
105
+
106
+ ```
107
+ $ pytest --testit --tmsUrl=URL --tmsPrivateToken=USER_PRIVATE_TOKEN --tmsProjectId=PROJECT_ID --tmsConfigurationId=CONFIGURATION_ID --tmsTestRunId=TEST_RUN_ID --tmsTestRunName=TEST_RUN_NAME --tmsAdapterMode=ADAPTER_MODE --tmsProxy='{"http":"http://localhost:8888","https":"http://localhost:8888"}' --tmsCertValidation=CERT_VALIDATION --tmsAutomaticCreationTestCases=AUTOMATIC_CREATION_TEST_CASES --tmsAutomaticUpdationLinksToTestCases=AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES --tmsImportRealtime=IMPORT_REALTIME
108
+ ```
109
+
110
+ If you want to enable debug mode then
111
+ see [How to enable debug logging?](https://github.com/testit-tms/adapters-python/tree/main/testit-python-commons)
112
+
113
+ #### Run with filter
114
+ To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):
115
+
116
+ ```
117
+ $ export TMS_TOKEN=<YOUR_TOKEN>
118
+ $ testit autotests_filter
119
+ --url https://tms.testit.software \
120
+ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
121
+ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
122
+ --framework pytest \
123
+ --output tmp/filter.txt
124
+
125
+ $ pytest "$(cat tmp/filter.txt)" --tmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 --tmsAdapterMode=1 --testit
126
+ ```
127
+
128
+ ### Decorators
129
+
130
+ Decorators can be used to specify information about autotest.
131
+
132
+ Description of decorators:
133
+
134
+ - `testit.workItemIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
135
+ - `testit.displayName` - internal autotest name (used in Test IT)
136
+ - `testit.externalId` - unique internal autotest ID (used in Test IT)
137
+ - `testit.title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
138
+ - `testit.description` - autotest description specified in the autotest card
139
+ - `testit.labels` - labels listed in the autotest card
140
+ - `testit.tags` - tags listed in the autotest card
141
+ - `testit.links` - links listed in the autotest card
142
+ - `testit.step` - the designation of the step called in the body of the test or other step
143
+ - `testit.nameSpace` - directory in the TMS system (default - file's name of test)
144
+ - `testit.className` - subdirectory in the TMS system (default - class's name of test)
145
+
146
+ All decorators support the use of parameterization attributes
147
+
148
+ Description of methods:
149
+
150
+ - `testit.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
151
+ - `testit.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
152
+ - `testit.addExternalId` - a dynamic method for adding unique internal autotest ID (used in Test IT)
153
+ - `testit.addTitle` - a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
154
+ - `testit.addDescription` - a dynamic method for adding autotest description specified in the autotest card
155
+ - `testit.addLabels` - a dynamic method for adding labels listed in the autotest card
156
+ - `testit.addTags` - a dynamic method for adding tags listed in the autotest card
157
+ - `testit.addLinks` - links in the autotest result
158
+ - `testit.addAttachments` - uploading files in the autotest result
159
+ - `testit.addMessage` - information about autotest in the autotest result
160
+ - `testit.addNameSpace` - a dynamic method for adding directory in the TMS system (default - file's name of test)
161
+ - `testit.addClassName` - a dynamic method for adding subdirectory in the TMS system (default - class's name of test)
162
+ - `testit.addParameter` - a dynamic method for adding parameter in the autotest result
163
+ - `testit.step` - usage in the "with" construct to designation a step in the body of the test
164
+
165
+ ### Examples
166
+
167
+ #### Simple test
168
+
169
+ ```py
170
+ import pytest
171
+ import testit
172
+
173
+
174
+ # Test with a minimal set of decorators
175
+ @testit.externalId('Simple_autotest2')
176
+ def test_2():
177
+ """Simple autotest 2"""
178
+ assert oneStep()
179
+ assert twoStep()
180
+
181
+
182
+ @testit.step
183
+ def oneStep():
184
+ assert oneOneStep()
185
+ assert oneTwoStep()
186
+ return True
187
+
188
+
189
+ @testit.step
190
+ def twoStep():
191
+ return True
192
+
193
+
194
+ @testit.step('step 1.1', 'description')
195
+ def oneOneStep():
196
+ return True
197
+
198
+
199
+ @testit.step('step 2')
200
+ def oneTwoStep():
201
+ return True
202
+
203
+
204
+ @testit.externalId('Simple_test_skip')
205
+ @testit.displayName('Simple test skip')
206
+ @testit.links(url='https://dumps.example.com/module/JCP-777')
207
+ @testit.links(url='https://dumps.example.com/module/JCP-777',
208
+ title='JCP-777',
209
+ type=testit.LinkType.RELATED,
210
+ description='Description of JCP-777')
211
+ @pytest.mark.skipif(True, reason='Because i can')
212
+ def test_skip():
213
+ assert True
214
+ ```
215
+
216
+ #### Parameterized test
217
+
218
+ > [!WARNING]
219
+ > When linking a parameterized autotest to a parameterized test case, please consider the problematic points:
220
+ > - In TMS test cases have a table with parameters, but autotests do not. They are not equal entities, so there may be incompatibility in terms of parameters
221
+ > - Running a parameterized test case, TMS expects the results of all related autotests with all the parameters specified in the test case table
222
+ > - In TMS, the parameters are limited to the string type, so the adapter transmits absolutely all the autotest parameters as a string. This implies the following problematic point for the test case table
223
+ > - TMS expects a complete **textual** match of the name and value of the parameters of the test case table with the autotest parameters
224
+
225
+ ```py
226
+ # Parameterized test with a full set of decorators
227
+ from os.path import join, dirname
228
+
229
+ import pytest
230
+ import testit
231
+
232
+
233
+ @testit.workItemIds(627)
234
+ @testit.displayName('Simple autotest 1 - {name}')
235
+ @testit.externalId('Simple_autotest1_{name}')
236
+ @testit.title('Authorization')
237
+ @testit.description('E2E_autotest')
238
+ @testit.tags('{tags}')
239
+ @testit.links(links=[
240
+ {'url': '{url}', 'type': '{link_type}', 'title': '{link_title}', 'description': '{link_desc}'},
241
+ {'url': '{url}', 'type': '{link_type}', 'title': '{link_title}', 'description': '{link_desc}'}
242
+ ])
243
+ @pytest.mark.parametrize('name, tags, url, link_type, link_title, link_desc', [
244
+ ('param 1', ['E2E', 'test'], 'https://dumps.example.com/module/JCP-777', testit.LinkType.DEFECT, 'JCP-777',
245
+ 'Desc of JCP-777'),
246
+ ('param 2', (), 'https://dumps.example.com/module/docs', testit.LinkType.RELATED, 'Documentation',
247
+ 'Desc of JCP-777'),
248
+ ('param 3', ('E2E', 'test'), 'https://dumps.example.com/module/projects', testit.LinkType.REQUIREMENT, 'Projects',
249
+ 'Desc of Projects'),
250
+ ('param 4', {'E2E', 'test'}, 'https://dumps.example.com/module/', testit.LinkType.BLOCKED_BY, '', ''),
251
+ ('param 5', 'test', 'https://dumps.example.com/module/repository', testit.LinkType.REPOSITORY, 'Repository',
252
+ 'Desc of Repository')
253
+ ])
254
+ def test_1(name, tags, url, link_type, link_title, link_desc):
255
+ testit.addLinks(url='https://dumps.example.com/module/some_module_dump', title='component_dump.dmp',
256
+ type=testit.LinkType.RELATED, description='Description')
257
+ testit.addLinks(url='https://dumps.example.com/module/some_module_dump')
258
+ testit.addLinks(links=[
259
+ {'url': 'https://dumps.example.com/module/some_module_dump', 'type': testit.LinkType.BLOCKED_BY,
260
+ 'title': 'component_dump.dmp', 'description': 'Description'},
261
+ {'url': 'https://dumps.example.com/module/some_module_dump', 'type': testit.LinkType.DEFECT},
262
+ {'url': 'https://dumps.example.com/module/some_module_dump', 'type': testit.LinkType.RELATED,
263
+ 'title': 'component_dump.dmp'},
264
+ {'url': 'https://dumps.example.com/module/some_module_dump', 'type': testit.LinkType.REQUIREMENT,
265
+ 'title': 'component_dump.dmp', 'description': 'Description'},
266
+ {'url': 'https://dumps.example.com/module/some_module_dump', 'type': testit.LinkType.REPOSITORY,
267
+ 'description': 'Description'},
268
+ {'url': 'https://dumps.example.com/module/some_module_dump'}
269
+ ])
270
+ with testit.step('Log in the system', 'system authentication'):
271
+ with testit.step('Enter the login', 'login was entered'):
272
+ with testit.step('Enter the password', 'password was entered'):
273
+ assert True
274
+ with testit.step('Create a project', 'the project was created'):
275
+ with testit.step('Enter the project', 'the contents of the project are displayed'):
276
+ assert True
277
+ with testit.step('Create a test case', 'test case was created'):
278
+ assert True
279
+ with testit.step('Attachments'):
280
+ testit.addAttachments(
281
+ join(dirname(__file__), 'docs/text_file.txt'),
282
+ join(dirname(__file__), 'pictures/picture.jpg'),
283
+ join(dirname(__file__), 'docs/document.docx')
284
+ )
285
+ testit.addAttachments(
286
+ join(dirname(__file__), 'docs/document.doc'),
287
+ join(dirname(__file__), 'docs/logs.log')
288
+ )
289
+ assert True
290
+ ```
291
+
292
+ # Contributing
293
+
294
+ You can help to develop the project. Any contributions are **greatly appreciated**.
295
+
296
+ * If you have suggestions for adding or removing projects, feel free
297
+ to [open an issue](https://github.com/testit-tms/adapters-python/issues/new) to discuss it, or directly create a pull
298
+ request after you edit the *README.md* file with necessary changes.
299
+ * Please make sure you check your spelling and grammar.
300
+ * Create individual PR for each suggestion.
301
+ * Please also read through
302
+ the [Code Of Conduct](https://github.com/testit-tms/adapters-python/blob/master/CODE_OF_CONDUCT.md) before posting
303
+ your first idea as well.
304
+
305
+ # License
306
+
307
+ Distributed under the Apache-2.0 License.
308
+ See [LICENSE](https://github.com/testit-tms/adapters-python/blob/master/LICENSE.md) for more information.
309
+
@@ -0,0 +1,12 @@
1
+ testit_adapter_pytest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ testit_adapter_pytest/fixture_context.py,sha256=c7vnvZj4PKmtXWAocRfu_aZ-BiLPes-8xvDDhg-WFZg,1368
3
+ testit_adapter_pytest/listener.py,sha256=8SPu8T2hNANSRYVPfmJAwbRZvPESUdIGYcFkKUAO6xA,14520
4
+ testit_adapter_pytest/plugin.py,sha256=dzbPw159ajKBTb_lL4jdzTaO-9anZ2gpt52AkA4h_cY,7614
5
+ testit_adapter_pytest/utils.py,sha256=O19oyzl1ApL5aKQXtqGLtOeSHWbFKpbjGkXCmzhdTcE,13819
6
+ testit_adapter_pytest/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ testit_adapter_pytest/models/executable_test.py,sha256=E88C3GfZkmTgzrdzRf5TdHmmeY6Ya5OwKKWDgBzn86E,1221
8
+ testit_adapter_pytest-4.2.8.dist-info/METADATA,sha256=X_CY1WJuAa61Ikr7dWp6TB95mN6TDO98CddDGzoRA84,20660
9
+ testit_adapter_pytest-4.2.8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
10
+ testit_adapter_pytest-4.2.8.dist-info/entry_points.txt,sha256=ynmafpofPT8-oJGr2Emh2QetqPcz6zQ18rnyVB9SDtg,64
11
+ testit_adapter_pytest-4.2.8.dist-info/top_level.txt,sha256=c8v2N32RD4QpUpZ5qdMxB-OLpCDcfHG_AliuCAkWe6M,22
12
+ testit_adapter_pytest-4.2.8.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [pytest11]
2
+ testit_adapter_pytest = testit_adapter_pytest.plugin
@@ -0,0 +1 @@
1
+ testit_adapter_pytest