Skip to content

Commit 83fa470

Browse files
committed
Revert "Update README.rst"
This reverts commit 4cae4b7.
1 parent 4cae4b7 commit 83fa470

File tree

1 file changed

+131
-3
lines changed

1 file changed

+131
-3
lines changed

README.rst

Lines changed: 131 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,19 @@ agent-python-pytest
1919
:alt: Join Slack chat!
2020

2121

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
2435
-----
2536

2637
Installation
@@ -68,12 +79,47 @@ Example of :code:`pytest.ini`:
6879
6980
- 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
7081

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`.
91+
- :code:`rp_launch_uuid_print_output = stderr` - Launch UUID print output. Default `stdout`. Possible values: [stderr, stdout].
92+
- :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.
100+
- :code:`rp_ignore_attributes = 'xfail' 'usefixture'` - Ignore specified pytest markers.
101+
- :code:`rp_is_skipped_an_issue = False` - Treat skipped tests as required investigation. Default `True`.
102+
- :code:`rp_hierarchy_dirs_level = 0` - Directory starting hierarchy level (from pytest.ini level) (default `0`).
103+
- :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+
71118
Examples
72119
~~~~~~~~
73120

74121
For logging of the test item flow to Report Portal, please, use the python
75122
logging handler provided by plugin like bellow:
76-
77123
in conftest.py:
78124

79125
.. code-block:: python
@@ -119,6 +165,31 @@ in tests:
119165
# This debug message will not be sent to the Report Portal.
120166
rp_logger.debug("Case1. Debug message")
121167
168+
Plugin can report doc-strings of tests as :code:`descriptions`:
169+
170+
.. code-block:: python
171+
172+
def test_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+
def test_one():
188+
pass
189+
190+
If you don't want to attach specific markers, list them in :code:`rp_ignore_attributes` parameter
191+
192+
122193
Launching
123194
~~~~~~~~~
124195

@@ -129,6 +200,63 @@ To run test with Report Portal you must provide '--reportportal' flag:
129200
py.test ./tests --reportportal
130201
131202
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.
213+
214+
Example:
215+
216+
.. code-block:: python
217+
218+
@pytest.mark.issue(issue_id="111111", reason="Some bug", issue_type="PB")
219+
def test():
220+
assert False
221+
222+
223+
Send attachment (screenshots)
224+
------------------------------
225+
226+
https://github.com/reportportal/client-Python#send-attachment-screenshots
227+
228+
Test internal steps, aka "Nested steps"
229+
---------------------------------------
230+
231+
To implement Nested steps reporting please follow our guide: https://github.com/reportportal/client-Python/wiki/Nested-steps
232+
233+
Also there are examples of usage:
234+
235+
* https://github.com/reportportal/examples-python/blob/master/pytest/tests/test_nested_steps.py
236+
* https://github.com/reportportal/examples-python/blob/master/pytest/tests/test_nested_steps_ui.py
237+
238+
Troubleshooting
239+
~~~~~~~~~~~~~~~
240+
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+
259+
132260
Copyright Notice
133261
----------------
134262
.. Copyright Notice: https://github.com/reportportal/agent-python-pytest#copyright-notice

0 commit comments

Comments
 (0)