You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+131-3Lines changed: 131 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,19 @@ agent-python-pytest
19
19
:alt:Join Slack chat!
20
20
21
21
22
-
Pytest plugin for reporting test results of the Pytest to the ReportPortal.
23
-
22
+
Pytest plugin for reporting test results of the Pytest to the Report Portal.
23
+
24
+
* Usage
25
+
* Installation
26
+
* Configuration
27
+
* Examples
28
+
* Launching
29
+
* Send attachment (screenshots)
30
+
* Troubleshooting
31
+
* Integration with GA
32
+
* Copyright Notice
33
+
34
+
Usage
24
35
-----
25
36
26
37
Installation
@@ -68,12 +79,47 @@ Example of :code:`pytest.ini`:
68
79
69
80
- The :code:`rp_api_key` can also be set with the environment variable `RP_API_KEY`. This will override the value set for :code:`rp_api_key` in pytest.ini
70
81
82
+
The following parameters are optional:
83
+
84
+
- :code:`rp_client_type = SYNC` - Type of the under-the-hood ReportPortal client implementation. Possible values: [SYNC, ASYNC_THREAD, ASYNC_BATCHED].
85
+
- :code:`rp_launch = AnyLaunchName` - launch name (could be overridden by pytest --rp-launch option, default value is 'Pytest Launch').
86
+
- :code:`rp_launch_id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` - id of the existing launch (the session will not handle the lifecycle of the given launch).
87
+
- :code:`rp_launch_attributes = 'PyTest' 'Smoke' 'Env:Python3'` - list of attributes for launch.
88
+
- :code:`rp_launch_description = 'Smoke test'` - launch description (could be overridden by pytest --rp-launch-description option, default value is '').
89
+
- :code:`rp_launch_timeout = 86400` - Maximum time to wait for child processes finish, default value: 86400 seconds (1 day).
90
+
- :code:`rp_launch_uuid_print = True` - Enables printing Launch UUID on test run start. Default `False`.
- :code:`rp_parent_item_id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` - id of the existing test item for session to use as parent item for the tests (the session will not handle the lifecycle of the given test item).
93
+
- :code:`rp_tests_attributes = 'PyTest' 'Smoke'` - list of attributes that will be added for each item in the launch.
94
+
- :code:`rp_connect_timeout = 15` - Connection timeout to ReportPortal server. Default value is "10.0".
95
+
- :code:`rp_read_timeout = 15` - Response read timeout for ReportPortal connection. Default value is "10.0".
96
+
- :code:`rp_log_batch_size = 20` - size of batch log request.
97
+
- :code:`rp_log_batch_payload_size = 65000000` - maximum payload size in bytes of async batch log requests.
98
+
- :code:`rp_log_level = INFO` - The log level that will be reported.
99
+
- :code:`rp_log_format = [%(levelname)7s] (%(name)s) %(message)s (%(filename)s:%(lineno)s)` - Format string to be used for logs sent to the service.
- :code:`rp_hierarchy_dirs = True` - Enables hierarchy for tests directories, default `False`. Doesn't support 'xdist' plugin.
104
+
- :code:`rp_hierarchy_dir_path_separator` - Path separator to display directories in test hierarchy. In case of empty value current system path separator will be used (os.path.sep).
105
+
- :code:`rp_hierarchy_code` - Enables hierarchy for inner classes and parametrized tests, default `False`. Doesn't support 'xdist' plugin.
106
+
- :code:`rp_issue_system_url = https://bugzilla.some.com/show_bug.cgi?id={issue_id}` - issue URL (issue_id will be filled by parameter from pytest mark).
107
+
- :code:`rp_issue_id_marks = True` - Enables adding marks for issue ids (e.g. "issue:123456").
108
+
- :code:`rp_verify_ssl = True` - Verify SSL when connecting to the server.
109
+
- :code:`rp_mode = DEFAULT` - DEBUG or DEFAULT launch mode. DEBUG launches are displayed in a separate tab and not visible to anyone except owner.
110
+
- :code:`rp_thread_logging` - EXPERIMENTAL - Enables support for reporting logs from threads by patching the builtin Thread class. Use with caution.
111
+
- :code:`rp_api_retries = 0` - Amount of retries for performing REST calls to RP server.
112
+
113
+
114
+
115
+
If you like to override the above parameters from command line, or from CI environment based on your build, then pass
116
+
- :code:`-o "rp_launch_attributes=Smoke Tests"` during invocation.
117
+
71
118
Examples
72
119
~~~~~~~~
73
120
74
121
For logging of the test item flow to Report Portal, please, use the python
75
122
logging handler provided by plugin like bellow:
76
-
77
123
in conftest.py:
78
124
79
125
.. code-block:: python
@@ -119,6 +165,31 @@ in tests:
119
165
# This debug message will not be sent to the Report Portal.
120
166
rp_logger.debug("Case1. Debug message")
121
167
168
+
Plugin can report doc-strings of tests as :code:`descriptions`:
169
+
170
+
.. code-block:: python
171
+
172
+
deftest_one():
173
+
"""
174
+
Description of the test case which will be sent to Report Portal
175
+
"""
176
+
pass
177
+
178
+
Pytest markers will be attached as :code:`attributes` to Report Portal items.
179
+
In the following example attributes 'linux' and 'win32' will be used:
180
+
181
+
.. code-block:: python
182
+
183
+
import pytest
184
+
185
+
@pytest.mark.win32
186
+
@pytest.mark.linux
187
+
deftest_one():
188
+
pass
189
+
190
+
If you don't want to attach specific markers, list them in :code:`rp_ignore_attributes` parameter
191
+
192
+
122
193
Launching
123
194
~~~~~~~~~
124
195
@@ -129,6 +200,63 @@ To run test with Report Portal you must provide '--reportportal' flag:
129
200
py.test ./tests --reportportal
130
201
131
202
203
+
Test issue info
204
+
~~~~~~~~~~~~~~~
205
+
206
+
Some pytest marks could be used to specify information about skipped or failed test result.
207
+
208
+
The following mark fields are used to get information about test issue:
209
+
210
+
- :code:`issue_id` - issue id (or list) in tracking system. This id will be added as comment to test fail result. If URL is specified in pytest ini file (see :code:`rp_issue_system_url`), id will added as link to tracking system.
211
+
- :code:`reason` - some comment that will be added to test fail description.
212
+
- :code:`issue_type` - short name of RP issue type that should be assigned to failed or skipped test.
If you would like to temporary disable integrations with Report Portal just
241
+
deactivate :code:`pytest_reportportal` plugin with command like:
242
+
243
+
.. code-block:: bash
244
+
245
+
py.test -p no:pytest_reportportal ./tests
246
+
247
+
248
+
Integration with Google analytics
249
+
---------------------------------
250
+
ReportPortal is now supporting integrations with more than 15 test frameworks simultaneously. In order to define the most popular agents and plan the team workload accordingly, we are using Google analytics.
251
+
252
+
ReportPortal collects information about agent name and its version only. This information is sent to Google Analytics on the launch start. Please help us to make our work effective.
253
+
If you still want to switch Off Google analytics, please change env variable the way below.
0 commit comments