testit-adapter-behave 2.1.2__tar.gz → 2.1.4__tar.gz
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.
- testit-adapter-behave-2.1.4/PKG-INFO +308 -0
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/README.md +293 -298
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/setup.cfg +4 -4
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/setup.py +27 -27
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/formatter.py +45 -45
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/listener.py +112 -112
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/models/label.py +5 -5
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/models/option.py +15 -15
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/models/tags.py +10 -8
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/models/test_result_step.py +14 -14
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/models/url_link.py +9 -9
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/scenario_parser.py +143 -137
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/tags_parser.py +84 -78
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/utils.py +88 -88
- testit-adapter-behave-2.1.4/src/testit_adapter_behave.egg-info/PKG-INFO +308 -0
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave.egg-info/SOURCES.txt +0 -1
- testit-adapter-behave-2.1.4/src/testit_adapter_behave.egg-info/requires.txt +3 -0
- testit-adapter-behave-2.1.2/PKG-INFO +0 -314
- testit-adapter-behave-2.1.2/requirements.txt +0 -3
- testit-adapter-behave-2.1.2/src/testit_adapter_behave.egg-info/PKG-INFO +0 -314
- testit-adapter-behave-2.1.2/src/testit_adapter_behave.egg-info/requires.txt +0 -3
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/__init__.py +0 -0
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave/models/__init__.py +0 -0
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave.egg-info/dependency_links.txt +0 -0
- {testit-adapter-behave-2.1.2 → testit-adapter-behave-2.1.4}/src/testit_adapter_behave.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: testit-adapter-behave
|
|
3
|
+
Version: 2.1.4
|
|
4
|
+
Summary: Behave 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.6
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# Test IT TMS adapter for Behave
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
## Getting Started
|
|
21
|
+
|
|
22
|
+
### Installation
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
pip install testit-adapter-behave
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Configuration
|
|
31
|
+
|
|
32
|
+
#### File
|
|
33
|
+
|
|
34
|
+
1. Create **connection_config.ini** file in the root directory of the project:
|
|
35
|
+
```
|
|
36
|
+
[testit]
|
|
37
|
+
URL = <url>
|
|
38
|
+
privateToken = <token>
|
|
39
|
+
projectId = <id>
|
|
40
|
+
configurationId = <id>
|
|
41
|
+
testRunId = <optional id>
|
|
42
|
+
testRunName = <optional name>
|
|
43
|
+
adapterMode = <optional>
|
|
44
|
+
certValidation = <optional boolean>
|
|
45
|
+
automaticCreationTestCases = <optional boolean>
|
|
46
|
+
|
|
47
|
+
# This section are optional. It enables debug mode.
|
|
48
|
+
[debug]
|
|
49
|
+
tmsProxy = {"http": "http://localhost:8888", "https": "http://localhost:8888"}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
2. Fill parameters with your configuration, where:
|
|
53
|
+
* `URL` - location of the TMS instance
|
|
54
|
+
|
|
55
|
+
* `privateToken` - API secret key
|
|
56
|
+
1. go to the https://{DOMAIN}/user-profile profile
|
|
57
|
+
2. copy the API secret key
|
|
58
|
+
|
|
59
|
+
* `projectId` - ID of project in TMS instance.
|
|
60
|
+
|
|
61
|
+
1. create a project
|
|
62
|
+
2. open DevTools -> network
|
|
63
|
+
3. go to the project https://{DOMAIN}/projects/{PROJECT_GLOBAL_ID}/tests
|
|
64
|
+
4. GET-request project, Preview tab, copy id field
|
|
65
|
+
|
|
66
|
+
* `configurationId` - ID of configuration in TMS instance.
|
|
67
|
+
|
|
68
|
+
1. create a project
|
|
69
|
+
2. open DevTools -> network
|
|
70
|
+
3. go to the project https://{DOMAIN}/projects/{PROJECT_GLOBAL_ID}/tests
|
|
71
|
+
4. GET-request configurations, Preview tab, copy id field
|
|
72
|
+
|
|
73
|
+
* `testRunId` - id of the created test run in TMS instance. `testRunId` is optional. If it is not provided, it is
|
|
74
|
+
created automatically.
|
|
75
|
+
|
|
76
|
+
* `testRunName` - parameter for specifying the name of test run in TMS instance. `testRunName` is optional. If it is
|
|
77
|
+
not provided, it is created automatically.
|
|
78
|
+
|
|
79
|
+
* `adapterMode` - adapter mode. Default value - 0. The adapter supports following modes:
|
|
80
|
+
|
|
81
|
+
* 0 - in this mode, the adapter filters tests by test run ID and configuration ID, and sends the results to the
|
|
82
|
+
test run.
|
|
83
|
+
* 1 - in this mode, the adapter sends all results to the test run without filtering.
|
|
84
|
+
* 2 - in this mode, the adapter creates a new test run and sends results to the new test run.
|
|
85
|
+
|
|
86
|
+
* `certValidation` - it enables/disables certificate validation. Default value - true.
|
|
87
|
+
|
|
88
|
+
* `automaticCreationTestCases` - mode of automatic creation test cases. Default value - false. The adapter supports following modes:
|
|
89
|
+
* true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest).
|
|
90
|
+
* false - in this mode, the adapter will not create a test case.
|
|
91
|
+
|
|
92
|
+
* `tmsProxy` - it enables debug mode. `tmsProxy` is optional.
|
|
93
|
+
|
|
94
|
+
#### ENV
|
|
95
|
+
|
|
96
|
+
You can use environment variables (environment variables take precedence over file variables):
|
|
97
|
+
|
|
98
|
+
* `TMS_URL` - location of the TMS instance.
|
|
99
|
+
|
|
100
|
+
* `TMS_PRIVATE_TOKEN` - API secret key.
|
|
101
|
+
|
|
102
|
+
* `TMS_PROJECT_ID` - ID of a project in TMS instance.
|
|
103
|
+
|
|
104
|
+
* `TMS_CONFIGURATION_ID` - ID of a configuration in TMS instance.
|
|
105
|
+
|
|
106
|
+
* `TMS_ADAPTER_MODE` - adapter mode. Default value - 0.
|
|
107
|
+
|
|
108
|
+
* `TMS_TEST_RUN_ID` - ID of the created test-run in TMS instance. `TMS_TEST_RUN_ID` is optional. If it is not provided,
|
|
109
|
+
it is created automatically.
|
|
110
|
+
|
|
111
|
+
* `TMS_TEST_RUN_NAME` - name of the new test-run.`TMS_TEST_RUN_NAME` is optional. If it is not provided, it is created
|
|
112
|
+
automatically.
|
|
113
|
+
|
|
114
|
+
* `TMS_CONFIG_FILE` - name of the configuration file. `TMS_CONFIG_FILE` is optional. If it is not provided, it is used
|
|
115
|
+
default file name.
|
|
116
|
+
|
|
117
|
+
* `TMS_PROXY` - it enables debug mode. `TMS_PROXY` is optional.
|
|
118
|
+
|
|
119
|
+
* `TMS_CERT_VALIDATION` - it enables/disables certificate validation. Default value - true.
|
|
120
|
+
|
|
121
|
+
* `TMS_AUTOMATIC_CREATION_TEST_CASES` - mode of automatic creation test cases. Default value - false.
|
|
122
|
+
|
|
123
|
+
#### Command line
|
|
124
|
+
|
|
125
|
+
You also can CLI variables (CLI variables take precedence over environment variables):
|
|
126
|
+
|
|
127
|
+
* `tmsUrl` - location of the TMS instance.
|
|
128
|
+
|
|
129
|
+
* `tmsPrivateToken` - API secret key.
|
|
130
|
+
|
|
131
|
+
* `tmsProjectId` - ID of a project in TMS instance.
|
|
132
|
+
|
|
133
|
+
* `tmsConfigurationId` - ID of a configuration in TMS instance.
|
|
134
|
+
|
|
135
|
+
* `tmsAdapterMode` - adapter mode. Default value - 0.
|
|
136
|
+
|
|
137
|
+
* `tmsTestRunId` - ID of the created test-run in TMS instance. `tmsTestRunId` is optional. If it is not provided, it is
|
|
138
|
+
created automatically.
|
|
139
|
+
|
|
140
|
+
* `tmsTestRunName` - name of the new test-run.`tmsTestRunName` is optional. If it is not provided, it is created
|
|
141
|
+
automatically.
|
|
142
|
+
|
|
143
|
+
* `tmsConfigFile` - name of the configuration file. `tmsConfigFile` is optional. If it is not provided, it is used
|
|
144
|
+
default file name.
|
|
145
|
+
|
|
146
|
+
* `tmsProxy` - it enables debug mode. `tmsProxy` is optional.
|
|
147
|
+
|
|
148
|
+
* `tmsCertValidation` - it enables/disables certificate validation. Default value - true.
|
|
149
|
+
|
|
150
|
+
* `tmsAutomaticCreationTestCases` - mode of automatic creation test cases. Default value - false.
|
|
151
|
+
|
|
152
|
+
#### Examples
|
|
153
|
+
|
|
154
|
+
Launch with a connection_config.ini file in the root directory of the project:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
$ behave -f testit_adapter_behave.formatter:AdapterFormatter
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Launch with command-line parameters:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
$ behave -f testit_adapter_behave.formatter:AdapterFormatter -D tmsUrl=<url> -D tmsPrivateToken=<token> -D
|
|
164
|
+
tmsProjectId=<id> -D tmsConfigurationId=<id> -D tmsTestRunId=<optional id> -D tmsAdapterMode=<optional> -D
|
|
165
|
+
tmsTestRunName=<optional name> -D tmsProxy='{"http":"http://localhost:8888","https":"http://localhost:8888"}' -D
|
|
166
|
+
tmsCertValidation=<optional boolean> -D tmsAutomaticCreationTestCases=<optional boolean>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
If you want to enable debug mode then
|
|
170
|
+
see [How to enable debug logging?](https://github.com/testit-tms/adapters-python/tree/main/testit-python-commons)
|
|
171
|
+
|
|
172
|
+
### Tags
|
|
173
|
+
|
|
174
|
+
Use tags to specify information about autotest.
|
|
175
|
+
|
|
176
|
+
Description of tags:
|
|
177
|
+
|
|
178
|
+
- `WorkItemIds` - linking an autotest to a test case
|
|
179
|
+
- `DisplayName` - name of the autotest in the TMS system
|
|
180
|
+
- `ExternalId` - ID of the autotest within the project in the TMS system
|
|
181
|
+
- `Title` - title in the autotest card
|
|
182
|
+
- `Description` - description in the autotest card
|
|
183
|
+
- `Labels` - tags in the autotest card
|
|
184
|
+
- `Links` - links in the autotest card
|
|
185
|
+
- `NameSpace` - directory in the TMS system (default - file's name of test)
|
|
186
|
+
- `ClassName` - subdirectory in the TMS system (default - class's name of test)
|
|
187
|
+
|
|
188
|
+
Description of methods:
|
|
189
|
+
|
|
190
|
+
- `testit.addLinks` - links in the autotest result
|
|
191
|
+
- `testit.addAttachments` - uploading files in the autotest result
|
|
192
|
+
- `testit.addMessage` - information about autotest in the autotest result
|
|
193
|
+
- `testit.step` - usage in the "with" construct to designation a step in the body of the test
|
|
194
|
+
|
|
195
|
+
### Examples
|
|
196
|
+
|
|
197
|
+
#### Simple Test
|
|
198
|
+
|
|
199
|
+
```py
|
|
200
|
+
import testit
|
|
201
|
+
from behave import given
|
|
202
|
+
from behave import then
|
|
203
|
+
from behave import when
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
@given("I authorize on the portal")
|
|
207
|
+
def authorization(context):
|
|
208
|
+
with testit.step("I set login"):
|
|
209
|
+
pass
|
|
210
|
+
with testit.step("I set password"):
|
|
211
|
+
pass
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
@when("I create a project")
|
|
215
|
+
def create_project(context):
|
|
216
|
+
pass
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
@when("I open the project")
|
|
220
|
+
def enter_project(context):
|
|
221
|
+
pass
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@when("I create a section")
|
|
225
|
+
def create_section(context):
|
|
226
|
+
testit.addLinks(
|
|
227
|
+
title='component_dump.dmp',
|
|
228
|
+
type=testit.LinkType.RELATED,
|
|
229
|
+
url='https://dumps.example.com/module/some_module_dump',
|
|
230
|
+
description='Description'
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
@then("I create a test case")
|
|
235
|
+
def create_test_case(context):
|
|
236
|
+
testit.addAttachments('pictures/picture.jpg')
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
```buildoutcfg
|
|
240
|
+
Feature: Sample
|
|
241
|
+
|
|
242
|
+
Background:
|
|
243
|
+
Given I authorize on the portal
|
|
244
|
+
|
|
245
|
+
@ExternalId=failed_with_all_annotations
|
|
246
|
+
@DisplayName=Failed_test_with_all_annotations
|
|
247
|
+
@WorkItemIds=123
|
|
248
|
+
@Title=Title_in_the_autotest_card
|
|
249
|
+
@Description=Test_with_all_annotations
|
|
250
|
+
@Labels=Tag1,Tag2
|
|
251
|
+
@Links={"url":"https://dumps.example.com/module/repository","title":"Repository","description":"Example_of_repository","type":"Repository"}
|
|
252
|
+
Scenario: Create new project, section and test case
|
|
253
|
+
When I create a project
|
|
254
|
+
And I open the project
|
|
255
|
+
And I create a section
|
|
256
|
+
Then I create a test case
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Parameterized test
|
|
260
|
+
|
|
261
|
+
```py
|
|
262
|
+
from behave import when
|
|
263
|
+
from behave import then
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@when("Summing {left:d}+{right:d}")
|
|
267
|
+
def step_impl(context, left, right):
|
|
268
|
+
context.sum = left + right
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
@then("Result is {result:d}")
|
|
272
|
+
def step_impl(context, result):
|
|
273
|
+
assert context.sum == result
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
```buildoutcfg
|
|
278
|
+
Feature: Rule
|
|
279
|
+
Tests that use Rule
|
|
280
|
+
|
|
281
|
+
Scenario Outline: Summing
|
|
282
|
+
When Summing <left>+<right>
|
|
283
|
+
Then Result is <result>
|
|
284
|
+
|
|
285
|
+
Examples:
|
|
286
|
+
| left | right | result |
|
|
287
|
+
| 1 | 1 | 3 |
|
|
288
|
+
| 9 | 9 | 18 |
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
# Contributing
|
|
292
|
+
|
|
293
|
+
You can help to develop the project. Any contributions are **greatly appreciated**.
|
|
294
|
+
|
|
295
|
+
* If you have suggestions for adding or removing projects, feel free
|
|
296
|
+
to [open an issue](https://github.com/testit-tms/adapters-python/issues/new) to discuss it, or directly create a pull
|
|
297
|
+
request after you edit the *README.md* file with necessary changes.
|
|
298
|
+
* Please make sure you check your spelling and grammar.
|
|
299
|
+
* Create individual PR for each suggestion.
|
|
300
|
+
* Please also read through
|
|
301
|
+
the [Code Of Conduct](https://github.com/testit-tms/adapters-python/blob/master/CODE_OF_CONDUCT.md) before posting
|
|
302
|
+
your first idea as well.
|
|
303
|
+
|
|
304
|
+
# License
|
|
305
|
+
|
|
306
|
+
Distributed under the Apache-2.0 License.
|
|
307
|
+
See [LICENSE](https://github.com/testit-tms/adapters-python/blob/master/LICENSE.md) for more information.
|
|
308
|
+
|