|
| 1 | +#ReportPortal python client |
| 2 | + |
| 3 | +[](https://pypi.python.org/pypi/reportportal-client) |
| 4 | + |
| 5 | +Library used only for implementors of custom listeners for ReportPortal |
| 6 | + |
| 7 | +## Allready implemented listeners: |
| 8 | +* Robot Framework (link) |
| 9 | + |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +The latest stable version is available on PyPI: |
| 14 | + |
| 15 | + pip install reportportal-client |
| 16 | + |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +Main classes are: |
| 21 | + |
| 22 | +- reportportal_client.ReportPortalService |
| 23 | +- reportportal_client.StartLaunchRQ |
| 24 | +- reportportal_client.StartTestItemRQ |
| 25 | +- reportportal_client.FinishTestItemRQ |
| 26 | +- reportportal_client.FinishExecutionRQ |
| 27 | +- reportportal_client.SaveLogRQ |
| 28 | + |
| 29 | +Basic usage example: |
| 30 | + |
| 31 | +```python |
| 32 | +from time import time |
| 33 | +from reportportal_client import (ReportPortalService, |
| 34 | + FinishExecutionRQ, |
| 35 | + StartLaunchRQ, StartTestItemRQ, |
| 36 | + FinishTestItemRQ, SaveLogRQ) |
| 37 | + |
| 38 | +def timestamp(): |
| 39 | + return str(int(time() * 1000)) |
| 40 | + |
| 41 | +endpoint = "https://urlpreportportal" |
| 42 | +project = "ProjectName" |
| 43 | +token = "uuid" #you can get it from profile page in ReportPortal |
| 44 | +launch_name = "name for launch" |
| 45 | +launch_doc = "Some text documentation for launch" |
| 46 | + |
| 47 | +service = ReportPortalService(endpoint=endpoint, |
| 48 | + project=project, |
| 49 | + token=uuid) |
| 50 | + |
| 51 | +#Start Launch |
| 52 | +sl_rq = StartLaunchRQ(name=launch_name, |
| 53 | + start_time=timestamp(), |
| 54 | + description=launch_doc) |
| 55 | +r = service.start_launch(sl_rq) |
| 56 | +launch_id = r.id |
| 57 | + |
| 58 | +#Finish Launch |
| 59 | +fl_rq = FinishExecutionRQ(end_time=timestamp(), |
| 60 | + status="PASSED") |
| 61 | +service.finish_launch(launch_id, fl_rq) |
| 62 | +``` |
| 63 | + |
| 64 | +# Copyright Notice |
| 65 | +Licensed under the [GPLv3](https://www.gnu.org/licenses/quick-guide-gplv3.html) |
| 66 | +license (see the LICENSE file). |
0 commit comments