testit-python-commons 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.
- api_client_syncstorage/__init__.py +27 -0
- api_client_syncstorage/api/__init__.py +3 -0
- api_client_syncstorage/api/completion_api.py +302 -0
- api_client_syncstorage/api/health_api.py +158 -0
- api_client_syncstorage/api/system_api.py +158 -0
- api_client_syncstorage/api/test_results_api.py +182 -0
- api_client_syncstorage/api/workers_api.py +308 -0
- api_client_syncstorage/api_client.py +898 -0
- api_client_syncstorage/apis/__init__.py +21 -0
- api_client_syncstorage/configuration.py +450 -0
- api_client_syncstorage/exceptions.py +158 -0
- api_client_syncstorage/model/__init__.py +5 -0
- api_client_syncstorage/model/completion_response.py +267 -0
- api_client_syncstorage/model/health_status_response.py +267 -0
- api_client_syncstorage/model/register_request.py +275 -0
- api_client_syncstorage/model/register_response.py +279 -0
- api_client_syncstorage/model/set_worker_status_request.py +271 -0
- api_client_syncstorage/model/set_worker_status_response.py +267 -0
- api_client_syncstorage/model/shutdown_response.py +267 -0
- api_client_syncstorage/model/test_result_cut_api_model.py +279 -0
- api_client_syncstorage/model/test_result_save_response.py +267 -0
- api_client_syncstorage/model_utils.py +2058 -0
- api_client_syncstorage/models/__init__.py +20 -0
- api_client_syncstorage/rest.py +356 -0
- testit.py +69 -0
- testit_python_commons/__init__.py +0 -0
- testit_python_commons/app_properties.py +257 -0
- testit_python_commons/client/__init__.py +9 -0
- testit_python_commons/client/api_client.py +560 -0
- testit_python_commons/client/client_configuration.py +74 -0
- testit_python_commons/client/converter.py +618 -0
- testit_python_commons/client/helpers/__init__.py +0 -0
- testit_python_commons/client/helpers/bulk_autotest_helper.py +246 -0
- testit_python_commons/client/helpers/threads_manager.py +86 -0
- testit_python_commons/client/models/__init__.py +8 -0
- testit_python_commons/client/models/threads_for_create_and_result.py +35 -0
- testit_python_commons/client/models/threads_for_update_and_result.py +45 -0
- testit_python_commons/configurations/__init__.py +0 -0
- testit_python_commons/configurations/properties_names.py +51 -0
- testit_python_commons/decorators.py +221 -0
- testit_python_commons/dynamic_methods.py +237 -0
- testit_python_commons/models/__init__.py +5 -0
- testit_python_commons/models/adapter_mode.py +4 -0
- testit_python_commons/models/fixture.py +24 -0
- testit_python_commons/models/link.py +53 -0
- testit_python_commons/models/link_type.py +10 -0
- testit_python_commons/models/outcome_type.py +5 -0
- testit_python_commons/models/status_type.py +6 -0
- testit_python_commons/models/step_result.py +90 -0
- testit_python_commons/models/test_result.py +297 -0
- testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +28 -0
- testit_python_commons/services/__init__.py +41 -0
- testit_python_commons/services/adapter_manager.py +318 -0
- testit_python_commons/services/adapter_manager_configuration.py +42 -0
- testit_python_commons/services/fixture_manager.py +60 -0
- testit_python_commons/services/fixture_storage.py +40 -0
- testit_python_commons/services/logger.py +32 -0
- testit_python_commons/services/plugin_manager.py +101 -0
- testit_python_commons/services/retry.py +92 -0
- testit_python_commons/services/step_manager.py +36 -0
- testit_python_commons/services/step_result_storage.py +26 -0
- testit_python_commons/services/sync_storage/__init__.py +9 -0
- testit_python_commons/services/sync_storage/sync_storage_runner.py +589 -0
- testit_python_commons/services/utils.py +132 -0
- testit_python_commons/step.py +101 -0
- testit_python_commons/utils/__init__.py +3 -0
- testit_python_commons/utils/html_escape_utils.py +219 -0
- testit_python_commons-4.2.8.dist-info/METADATA +52 -0
- testit_python_commons-4.2.8.dist-info/RECORD +71 -0
- testit_python_commons-4.2.8.dist-info/WHEEL +5 -0
- testit_python_commons-4.2.8.dist-info/top_level.txt +3 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import inspect
|
|
3
|
+
import logging
|
|
4
|
+
import types
|
|
5
|
+
from functools import wraps
|
|
6
|
+
|
|
7
|
+
from testit_python_commons.services.logger import adapter_logger
|
|
8
|
+
from testit_python_commons.services.utils import Utils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def inner(function):
|
|
12
|
+
def set_properties(kwargs):
|
|
13
|
+
if not hasattr(function, 'test_properties') and kwargs:
|
|
14
|
+
function.test_properties = {}
|
|
15
|
+
|
|
16
|
+
for key, value in kwargs.items():
|
|
17
|
+
if hasattr(function,
|
|
18
|
+
'callspec') and key not in function.callspec.params:
|
|
19
|
+
function.test_properties[key] = str(value)
|
|
20
|
+
|
|
21
|
+
@wraps(function)
|
|
22
|
+
def sync_wrapper(*args, **kwargs):
|
|
23
|
+
set_properties(kwargs)
|
|
24
|
+
function(*args, **kwargs)
|
|
25
|
+
|
|
26
|
+
@wraps(function)
|
|
27
|
+
async def async_wrapper(*args, **kwargs):
|
|
28
|
+
set_properties(kwargs)
|
|
29
|
+
await function(*args, **kwargs)
|
|
30
|
+
|
|
31
|
+
if isinstance(function, types.FunctionType):
|
|
32
|
+
if inspect.iscoroutinefunction(function):
|
|
33
|
+
return async_wrapper
|
|
34
|
+
|
|
35
|
+
return sync_wrapper
|
|
36
|
+
|
|
37
|
+
return function
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@Utils.deprecated('Use "workItemIds" instead.')
|
|
41
|
+
@adapter_logger
|
|
42
|
+
def workItemID(*test_workitems_id: int or str): # noqa: N802
|
|
43
|
+
def outer(function):
|
|
44
|
+
function.test_workitems_id = []
|
|
45
|
+
for test_workitem_id in test_workitems_id:
|
|
46
|
+
function.test_workitems_id.append(str(test_workitem_id))
|
|
47
|
+
return inner(function)
|
|
48
|
+
|
|
49
|
+
return outer
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@adapter_logger
|
|
53
|
+
def workItemIds(*test_workitems_id: int or str): # noqa: N802
|
|
54
|
+
"""
|
|
55
|
+
specifies a method that links autotests with manual tests. Receives the array of manual tests' IDs
|
|
56
|
+
"""
|
|
57
|
+
def outer(function): # noqa: N802
|
|
58
|
+
function.test_workitems_id = []
|
|
59
|
+
for test_workitem_id in test_workitems_id:
|
|
60
|
+
function.test_workitems_id.append(str(test_workitem_id))
|
|
61
|
+
return inner(function)
|
|
62
|
+
|
|
63
|
+
return outer
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@adapter_logger
|
|
67
|
+
def displayName(test_displayname: str): # noqa: N802
|
|
68
|
+
"""
|
|
69
|
+
specifies internal autotest name (used in Test IT)
|
|
70
|
+
"""
|
|
71
|
+
def outer(function):
|
|
72
|
+
function.test_displayname = test_displayname
|
|
73
|
+
return inner(function)
|
|
74
|
+
|
|
75
|
+
return outer
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@adapter_logger
|
|
79
|
+
def nameSpace(test_namespace: str): # noqa: N802
|
|
80
|
+
"""
|
|
81
|
+
specifies directory in the TMS system (default - file's name of test)
|
|
82
|
+
"""
|
|
83
|
+
def outer(function):
|
|
84
|
+
function.test_namespace = test_namespace
|
|
85
|
+
return inner(function)
|
|
86
|
+
|
|
87
|
+
return outer
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@adapter_logger
|
|
91
|
+
def className(test_classname: str): # noqa: N802
|
|
92
|
+
"""
|
|
93
|
+
specifies subdirectory in the TMS system (default - class's name of test)
|
|
94
|
+
"""
|
|
95
|
+
def outer(function):
|
|
96
|
+
function.test_classname = test_classname
|
|
97
|
+
return inner(function)
|
|
98
|
+
|
|
99
|
+
return outer
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@Utils.deprecated('Use "externalId" instead.')
|
|
103
|
+
@adapter_logger
|
|
104
|
+
def externalID(test_external_id: str): # noqa: N802
|
|
105
|
+
def outer(function):
|
|
106
|
+
function.test_external_id = test_external_id
|
|
107
|
+
return inner(function)
|
|
108
|
+
|
|
109
|
+
return outer
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@adapter_logger
|
|
113
|
+
def externalId(test_external_id: str): # noqa: N802
|
|
114
|
+
"""
|
|
115
|
+
specifies unique internal autotest ID (used in Test IT)
|
|
116
|
+
"""
|
|
117
|
+
def outer(function):
|
|
118
|
+
function.test_external_id = test_external_id
|
|
119
|
+
return inner(function)
|
|
120
|
+
|
|
121
|
+
return outer
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@adapter_logger
|
|
125
|
+
def title(test_title: str):
|
|
126
|
+
"""
|
|
127
|
+
specifies autotest name specified in the autotest card.
|
|
128
|
+
If not specified, the name from the displayName method is used
|
|
129
|
+
"""
|
|
130
|
+
def outer(function):
|
|
131
|
+
function.test_title = test_title
|
|
132
|
+
return inner(function)
|
|
133
|
+
|
|
134
|
+
return outer
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@adapter_logger
|
|
138
|
+
def description(test_description: str):
|
|
139
|
+
"""
|
|
140
|
+
specifies autotest description specified in the autotest card
|
|
141
|
+
"""
|
|
142
|
+
def outer(function):
|
|
143
|
+
function.test_description = test_description
|
|
144
|
+
return inner(function)
|
|
145
|
+
|
|
146
|
+
return outer
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@Utils.deprecated('Use "tags" instead.')
|
|
150
|
+
@adapter_logger
|
|
151
|
+
def labels(*test_labels: str):
|
|
152
|
+
"""
|
|
153
|
+
specifies labels listed in the autotest card
|
|
154
|
+
"""
|
|
155
|
+
def outer(function):
|
|
156
|
+
function.test_labels = test_labels
|
|
157
|
+
return inner(function)
|
|
158
|
+
|
|
159
|
+
return outer
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@adapter_logger
|
|
163
|
+
def tags(*test_tags: str):
|
|
164
|
+
"""
|
|
165
|
+
specifies tags listed in the autotest card
|
|
166
|
+
"""
|
|
167
|
+
def outer(function):
|
|
168
|
+
function.test_tags = test_tags
|
|
169
|
+
return inner(function)
|
|
170
|
+
|
|
171
|
+
return outer
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
@Utils.deprecated('Use "links" instead.')
|
|
175
|
+
@adapter_logger
|
|
176
|
+
def link(url: str, title: str = None, type: str = None, description: str = None): # noqa: A002,VNE003
|
|
177
|
+
def outer(function):
|
|
178
|
+
if not hasattr(function, 'test_links'):
|
|
179
|
+
function.test_links = []
|
|
180
|
+
|
|
181
|
+
function.test_links.append(
|
|
182
|
+
Utils.convert_link_dict_to_link_model({
|
|
183
|
+
"url": url,
|
|
184
|
+
"title": title,
|
|
185
|
+
"type": type,
|
|
186
|
+
"description": description}))
|
|
187
|
+
|
|
188
|
+
return inner(function)
|
|
189
|
+
|
|
190
|
+
return outer
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
@adapter_logger
|
|
194
|
+
def links(url: str = None, title: str = None, type: str = None, # noqa: A002,VNE003
|
|
195
|
+
description: str = None, links: list or tuple = None):
|
|
196
|
+
"""
|
|
197
|
+
specifies links listed in the autotest card
|
|
198
|
+
"""
|
|
199
|
+
def outer(function):
|
|
200
|
+
if not hasattr(function, 'test_links'):
|
|
201
|
+
function.test_links = []
|
|
202
|
+
|
|
203
|
+
if url:
|
|
204
|
+
function.test_links.append(
|
|
205
|
+
Utils.convert_link_dict_to_link_model({
|
|
206
|
+
"url": url,
|
|
207
|
+
"title": title,
|
|
208
|
+
"type": type,
|
|
209
|
+
"description": description}))
|
|
210
|
+
elif links and (isinstance(links, list) or isinstance(links, tuple)):
|
|
211
|
+
for link in links:
|
|
212
|
+
if isinstance(link, dict) and 'url' in link:
|
|
213
|
+
function.test_links.append(
|
|
214
|
+
Utils.convert_link_dict_to_link_model(link))
|
|
215
|
+
else:
|
|
216
|
+
logging.warning(f'Link ({link}) can\'t be processed!')
|
|
217
|
+
else:
|
|
218
|
+
logging.warning(f'Links for {function.__name__} can\'t be processed!\nPlease, set "url" or "links"!')
|
|
219
|
+
return inner(function)
|
|
220
|
+
|
|
221
|
+
return outer
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from testit_python_commons.services import TmsPluginManager
|
|
4
|
+
from testit_python_commons.services.logger import adapter_logger
|
|
5
|
+
from testit_python_commons.services.utils import Utils
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@Utils.deprecated('Use "addLinks" instead.')
|
|
9
|
+
@adapter_logger
|
|
10
|
+
def addLink(url: str, title: str = None, type: str = None, description: str = None): # noqa: A002,VNE003,N802
|
|
11
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_link'):
|
|
12
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
13
|
+
.add_link(
|
|
14
|
+
link=Utils.convert_link_dict_to_link_model({
|
|
15
|
+
"url": url,
|
|
16
|
+
"title": title,
|
|
17
|
+
"type": type,
|
|
18
|
+
"description": description}))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@adapter_logger
|
|
22
|
+
def addLinks(url: str = None, title: str = None, type: str = None, description: str = None, # noqa: A002,VNE003,N802
|
|
23
|
+
links: list or tuple = None):
|
|
24
|
+
"""
|
|
25
|
+
links in the autotest result
|
|
26
|
+
"""
|
|
27
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_link'):
|
|
28
|
+
if url:
|
|
29
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
30
|
+
.add_link(
|
|
31
|
+
link=Utils.convert_link_dict_to_link_model({
|
|
32
|
+
"url": url,
|
|
33
|
+
"title": title,
|
|
34
|
+
"type": type,
|
|
35
|
+
"description": description}))
|
|
36
|
+
elif links and (isinstance(links, list) or isinstance(links, tuple)):
|
|
37
|
+
for link in links:
|
|
38
|
+
if isinstance(link, dict) and 'url' in link:
|
|
39
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
40
|
+
.add_link(link=Utils.convert_link_dict_to_link_model(link))
|
|
41
|
+
else:
|
|
42
|
+
logging.warning(f'Link ({link}) can\'t be processed!')
|
|
43
|
+
else:
|
|
44
|
+
logging.warning("Links can't be processed!\nPlease, set 'url' or 'links'!")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@Utils.deprecated('Use "addMessage" instead.')
|
|
48
|
+
@adapter_logger
|
|
49
|
+
def message(test_message: str):
|
|
50
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_message'):
|
|
51
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
52
|
+
.add_message(test_message=test_message)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@adapter_logger
|
|
56
|
+
def addMessage(test_message: str): # noqa: N802
|
|
57
|
+
"""
|
|
58
|
+
information about autotest in the autotest result
|
|
59
|
+
"""
|
|
60
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_message'):
|
|
61
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
62
|
+
.add_message(test_message=test_message)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@Utils.deprecated('Use "addAttachments" instead.')
|
|
66
|
+
@adapter_logger
|
|
67
|
+
def attachments(*attachments_paths):
|
|
68
|
+
active_step = TmsPluginManager.get_step_manager().get_active_step()
|
|
69
|
+
|
|
70
|
+
if active_step:
|
|
71
|
+
adapter_manager = TmsPluginManager.get_adapter_manager()
|
|
72
|
+
if not adapter_manager:
|
|
73
|
+
return
|
|
74
|
+
attachment_ids = adapter_manager.load_attachments(attachments_paths)
|
|
75
|
+
|
|
76
|
+
active_step.set_attachments(active_step.get_attachments() + attachment_ids)
|
|
77
|
+
else:
|
|
78
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_attachments'):
|
|
79
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
80
|
+
.add_attachments(attach_paths=attachments_paths)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@adapter_logger
|
|
84
|
+
def addAttachments(data, is_text: bool = False, name: str = None): # noqa: N802
|
|
85
|
+
"""
|
|
86
|
+
uploading files in the autotest result
|
|
87
|
+
"""
|
|
88
|
+
active_step = TmsPluginManager.get_step_manager().get_active_step()
|
|
89
|
+
|
|
90
|
+
if active_step:
|
|
91
|
+
__add_attachments_to_step(active_step, data, is_text, name)
|
|
92
|
+
else:
|
|
93
|
+
__add_attachments_to_test(data, is_text, name)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@adapter_logger
|
|
97
|
+
def __add_attachments_to_step(step, data, is_text: bool = False, name: str = None):
|
|
98
|
+
adapter_manager = TmsPluginManager.get_adapter_manager()
|
|
99
|
+
if not adapter_manager:
|
|
100
|
+
return
|
|
101
|
+
if is_text:
|
|
102
|
+
attachment_ids = adapter_manager.create_attachment(data, name)
|
|
103
|
+
else:
|
|
104
|
+
if isinstance(data, str):
|
|
105
|
+
attachment_ids = adapter_manager.load_attachments([data])
|
|
106
|
+
elif isinstance(data, tuple) or isinstance(data, list):
|
|
107
|
+
attachment_ids = adapter_manager.load_attachments(data)
|
|
108
|
+
else:
|
|
109
|
+
logging.warning(f'File ({data}) not found!')
|
|
110
|
+
return
|
|
111
|
+
|
|
112
|
+
step.set_attachments(step.get_attachments() + attachment_ids)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@adapter_logger
|
|
116
|
+
def __add_attachments_to_test(data, is_text: bool = False, name: str = None):
|
|
117
|
+
if is_text and hasattr(TmsPluginManager.get_plugin_manager().hook, 'create_attachment'):
|
|
118
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
119
|
+
.create_attachment(
|
|
120
|
+
body=data,
|
|
121
|
+
name=name)
|
|
122
|
+
elif hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_attachments'):
|
|
123
|
+
if isinstance(data, str):
|
|
124
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
125
|
+
.add_attachments(attach_paths=[data])
|
|
126
|
+
elif isinstance(data, tuple) or isinstance(data, list):
|
|
127
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
128
|
+
.add_attachments(attach_paths=data)
|
|
129
|
+
else:
|
|
130
|
+
logging.warning(f'({data}) is not path!')
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@adapter_logger
|
|
134
|
+
def addWorkItemIds(*test_work_item_ids: int or str): # noqa: N802
|
|
135
|
+
"""
|
|
136
|
+
a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
|
|
137
|
+
"""
|
|
138
|
+
if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_work_item_id'):
|
|
139
|
+
return
|
|
140
|
+
|
|
141
|
+
for test_work_item_id in test_work_item_ids:
|
|
142
|
+
TmsPluginManager.get_plugin_manager().hook.add_work_item_id(test_work_item_id=str(test_work_item_id))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@adapter_logger
|
|
146
|
+
def addDisplayName(test_display_name: str): # noqa: N802
|
|
147
|
+
"""
|
|
148
|
+
a dynamic method for adding internal autotest name (used in Test IT)
|
|
149
|
+
"""
|
|
150
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_display_name'):
|
|
151
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
152
|
+
.add_display_name(test_display_name=str(test_display_name))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@adapter_logger
|
|
156
|
+
def addNameSpace(test_namespace: str): # noqa: N802
|
|
157
|
+
"""
|
|
158
|
+
a dynamic method for adding directory in the TMS system (default - file's name of test)
|
|
159
|
+
"""
|
|
160
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_namespace'):
|
|
161
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
162
|
+
.add_namespace(test_namespace=str(test_namespace))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@adapter_logger
|
|
166
|
+
def addClassName(test_classname: str): # noqa: N802
|
|
167
|
+
"""
|
|
168
|
+
a dynamic method for adding subdirectory in the TMS system (default - class's name of test)
|
|
169
|
+
"""
|
|
170
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_classname'):
|
|
171
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
172
|
+
.add_classname(test_classname=str(test_classname))
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@adapter_logger
|
|
176
|
+
def addExternalId(test_external_id: str): # noqa: N802
|
|
177
|
+
"""
|
|
178
|
+
a dynamic method for adding unique internal autotest ID (used in Test IT)
|
|
179
|
+
"""
|
|
180
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_external_id'):
|
|
181
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
182
|
+
.add_external_id(test_external_id=str(test_external_id))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
@adapter_logger
|
|
186
|
+
def addTitle(test_title: str): # noqa: N802
|
|
187
|
+
"""
|
|
188
|
+
a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
|
|
189
|
+
"""
|
|
190
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_title'):
|
|
191
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
192
|
+
.add_title(test_title=str(test_title))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@adapter_logger
|
|
196
|
+
def addDescription(test_description: str): # noqa: N802
|
|
197
|
+
"""
|
|
198
|
+
a dynamic method for adding autotest description specified in the autotest card
|
|
199
|
+
"""
|
|
200
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_description'):
|
|
201
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
202
|
+
.add_description(test_description=str(test_description))
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
@Utils.deprecated('Use "addTags" instead.')
|
|
206
|
+
@adapter_logger
|
|
207
|
+
def addLabels(*test_labels: str): # noqa: N802
|
|
208
|
+
"""
|
|
209
|
+
a dynamic method for adding labels listed in the autotest card
|
|
210
|
+
"""
|
|
211
|
+
if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_label'):
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
for test_label in test_labels:
|
|
215
|
+
TmsPluginManager.get_plugin_manager().hook.add_label(test_label=str(test_label))
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@adapter_logger
|
|
219
|
+
def addTags(*test_tags: str): # noqa: N802
|
|
220
|
+
"""
|
|
221
|
+
a dynamic method for adding tags listed in the autotest card
|
|
222
|
+
"""
|
|
223
|
+
if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_tag'):
|
|
224
|
+
return
|
|
225
|
+
|
|
226
|
+
for test_tag in test_tags:
|
|
227
|
+
TmsPluginManager.get_plugin_manager().hook.add_tag(test_tag=str(test_tag))
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@adapter_logger
|
|
231
|
+
def addParameter(name: str, value: str): # noqa: N802
|
|
232
|
+
"""
|
|
233
|
+
a dynamic method for adding parameter in the autotest result
|
|
234
|
+
"""
|
|
235
|
+
if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_parameter'):
|
|
236
|
+
TmsPluginManager.get_plugin_manager().hook \
|
|
237
|
+
.add_parameter(name=str(name), value=str(value))
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from attr import attrs, attrib
|
|
2
|
+
from attr import Factory
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@attrs
|
|
6
|
+
class FixtureResult:
|
|
7
|
+
title = attrib(default=None)
|
|
8
|
+
outcome = attrib(default=None)
|
|
9
|
+
description = attrib(default=None)
|
|
10
|
+
message = attrib(default=None)
|
|
11
|
+
stacktrace = attrib(default=None)
|
|
12
|
+
steps = attrib(default=None)
|
|
13
|
+
attachments = attrib(default=Factory(list))
|
|
14
|
+
parameters = attrib(default=Factory(list))
|
|
15
|
+
start = attrib(default=None)
|
|
16
|
+
stop = attrib(default=None)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@attrs
|
|
20
|
+
class FixturesContainer:
|
|
21
|
+
uuid = attrib(default=None)
|
|
22
|
+
external_ids = attrib(default=Factory(list))
|
|
23
|
+
befores = attrib(default=Factory(list))
|
|
24
|
+
afters = attrib(default=Factory(list))
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from testit_python_commons.models.link_type import LinkType
|
|
2
|
+
from testit_python_commons.services.logger import adapter_logger
|
|
3
|
+
from testit_python_commons.utils import HtmlEscapeUtils
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Link:
|
|
7
|
+
__url: str = None
|
|
8
|
+
__title: str = None
|
|
9
|
+
__link_type: LinkType = None
|
|
10
|
+
__description: str = None
|
|
11
|
+
|
|
12
|
+
@adapter_logger
|
|
13
|
+
def set_url(self, url: str):
|
|
14
|
+
self.__url = url
|
|
15
|
+
|
|
16
|
+
return self
|
|
17
|
+
|
|
18
|
+
@adapter_logger
|
|
19
|
+
def get_url(self) -> str:
|
|
20
|
+
return self.__url
|
|
21
|
+
|
|
22
|
+
@adapter_logger
|
|
23
|
+
def set_title(self, title: str):
|
|
24
|
+
self.__title = HtmlEscapeUtils.escape_html_tags(title)
|
|
25
|
+
|
|
26
|
+
return self
|
|
27
|
+
|
|
28
|
+
@adapter_logger
|
|
29
|
+
def get_title(self) -> str:
|
|
30
|
+
return self.__title
|
|
31
|
+
|
|
32
|
+
@adapter_logger
|
|
33
|
+
def set_link_type(self, link_type: LinkType):
|
|
34
|
+
if link_type is None:
|
|
35
|
+
link_type = LinkType.RELATED
|
|
36
|
+
|
|
37
|
+
self.__link_type = link_type
|
|
38
|
+
|
|
39
|
+
return self
|
|
40
|
+
|
|
41
|
+
@adapter_logger
|
|
42
|
+
def get_link_type(self) -> LinkType:
|
|
43
|
+
return self.__link_type
|
|
44
|
+
|
|
45
|
+
@adapter_logger
|
|
46
|
+
def set_description(self, description: str):
|
|
47
|
+
self.__description = HtmlEscapeUtils.escape_html_tags(description)
|
|
48
|
+
|
|
49
|
+
return self
|
|
50
|
+
|
|
51
|
+
@adapter_logger
|
|
52
|
+
def get_description(self) -> str:
|
|
53
|
+
return self.__description
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from testit_python_commons.utils.html_escape_utils import HtmlEscapeUtils
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class StepResult:
|
|
5
|
+
__title: str = None
|
|
6
|
+
__outcome: str = None
|
|
7
|
+
__description: str = None
|
|
8
|
+
__duration: int = None
|
|
9
|
+
__started_on: str = None
|
|
10
|
+
__completed_on: str = None
|
|
11
|
+
__step_results: list = None
|
|
12
|
+
__attachments: list = None
|
|
13
|
+
__parameters: dict = None
|
|
14
|
+
|
|
15
|
+
def __init__(self):
|
|
16
|
+
self.__step_results = []
|
|
17
|
+
self.__attachments = []
|
|
18
|
+
self.__parameters = {}
|
|
19
|
+
|
|
20
|
+
def set_title(self, title: str):
|
|
21
|
+
self.__title = HtmlEscapeUtils.escape_html_tags(title)
|
|
22
|
+
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
def get_title(self) -> str:
|
|
26
|
+
return self.__title
|
|
27
|
+
|
|
28
|
+
def set_outcome(self, outcome: str):
|
|
29
|
+
self.__outcome = HtmlEscapeUtils.escape_html_tags(outcome)
|
|
30
|
+
|
|
31
|
+
return self
|
|
32
|
+
|
|
33
|
+
def get_outcome(self) -> str:
|
|
34
|
+
return self.__outcome
|
|
35
|
+
|
|
36
|
+
def set_description(self, description: str):
|
|
37
|
+
self.__description = HtmlEscapeUtils.escape_html_tags(description)
|
|
38
|
+
|
|
39
|
+
return self
|
|
40
|
+
|
|
41
|
+
def get_description(self) -> str:
|
|
42
|
+
return self.__description
|
|
43
|
+
|
|
44
|
+
def set_duration(self, duration: int):
|
|
45
|
+
self.__duration = duration
|
|
46
|
+
|
|
47
|
+
return self
|
|
48
|
+
|
|
49
|
+
def get_duration(self) -> int:
|
|
50
|
+
return self.__duration
|
|
51
|
+
|
|
52
|
+
def set_started_on(self, started_on: str):
|
|
53
|
+
self.__started_on = started_on
|
|
54
|
+
|
|
55
|
+
return self
|
|
56
|
+
|
|
57
|
+
def get_started_on(self) -> str:
|
|
58
|
+
return self.__started_on
|
|
59
|
+
|
|
60
|
+
def set_completed_on(self, completed_on: str):
|
|
61
|
+
self.__completed_on = completed_on
|
|
62
|
+
|
|
63
|
+
return self
|
|
64
|
+
|
|
65
|
+
def get_completed_on(self) -> str:
|
|
66
|
+
return self.__completed_on
|
|
67
|
+
|
|
68
|
+
def set_step_results(self, step_results: list):
|
|
69
|
+
self.__step_results = step_results
|
|
70
|
+
|
|
71
|
+
return self
|
|
72
|
+
|
|
73
|
+
def get_step_results(self) -> list:
|
|
74
|
+
return self.__step_results
|
|
75
|
+
|
|
76
|
+
def set_attachments(self, attachments: list):
|
|
77
|
+
self.__attachments = attachments
|
|
78
|
+
|
|
79
|
+
return self
|
|
80
|
+
|
|
81
|
+
def get_attachments(self) -> list:
|
|
82
|
+
return self.__attachments
|
|
83
|
+
|
|
84
|
+
def set_parameters(self, parameters: dict):
|
|
85
|
+
self.__parameters = HtmlEscapeUtils.escape_html_in_object(parameters)
|
|
86
|
+
|
|
87
|
+
return self
|
|
88
|
+
|
|
89
|
+
def get_parameters(self) -> dict:
|
|
90
|
+
return self.__parameters
|