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
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
35
-
-----
22
+
Pytest plugin for reporting test results of the Pytest to the ReportPortal.
36
23
37
24
Installation
38
25
~~~~~~~~~~~~
@@ -61,8 +48,8 @@ any one using pytest command line option:
61
48
The :code:`pytest.ini` file should have next mandatory fields:
62
49
63
50
- :code:`rp_api_key` - value could be found in the User Profile section
64
-
- :code:`rp_project` - name of project in Report Portal
65
-
- :code:`rp_endpoint` - address of Report Portal Server
51
+
- :code:`rp_project` - name of project in ReportPortal
52
+
- :code:`rp_endpoint` - address of ReportPortal Server
66
53
67
54
Example of :code:`pytest.ini`:
68
55
@@ -79,47 +66,15 @@ Example of :code:`pytest.ini`:
79
66
80
67
- 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
81
68
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.
For logging of the test item flow to Report Portal, please, use the python
75
+
For logging of the test item flow to ReportPortal, please, use the python
122
76
logging handler provided by plugin like bellow:
77
+
123
78
in conftest.py:
124
79
125
80
.. code-block:: python
@@ -143,7 +98,7 @@ in tests:
143
98
144
99
.. code-block:: python
145
100
146
-
# In this case only INFO messages will be sent to the Report Portal.
101
+
# In this case only INFO messages will be sent to the ReportPortal.
147
102
deftest_one(rp_logger):
148
103
rp_logger.info("Case1. Step1")
149
104
x ="this"
@@ -162,100 +117,20 @@ in tests:
162
117
},
163
118
)
164
119
165
-
# This debug message will not be sent to the Report Portal.
120
+
# This debug message will not be sent to the ReportPortal.
166
121
rp_logger.debug("Case1. Debug message")
167
122
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
-
193
123
Launching
194
124
~~~~~~~~~
195
125
196
-
To run test with Report Portal you must provide '--reportportal' flag:
126
+
To run test with ReportPortal you must provide '--reportportal' flag:
197
127
198
128
.. code-block:: bash
199
129
200
130
py.test ./tests --reportportal
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.
254
-
255
-
.. code-block:: bash
256
-
257
-
export AGENT_NO_ANALYTICS=1
258
-
132
+
Check the documentation to find more detailed information about how to integrate pytest with ReportPortal using an agent:
0 commit comments