Skip to content

Commit 6399511

Browse files
authored
Allow reporting to an existing launch.
Allow reporting to an existing launch.
2 parents b24b932 + 71569d5 commit 6399511

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ REQUIRED:
5151
```
5252
NOT REQUIRED:
5353
```
54+
--variable RP_LAUNCH_UUID:"id_of_existing_rp_launch"
55+
- ID of existing Report Portal launch
5456
--variable RP_LAUNCH_DOC:"some_documentation_for_launch"
5557
- Description for the launch
5658
--variable RP_LAUNCH_TAGS:"RF Smoke"

robotframework_reportportal/listener.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,25 @@
99
items = []
1010

1111

12+
def start_launch(launch):
13+
"""Start a new launch at the Report Portal."""
14+
if not Variables.launch_id:
15+
launch.doc = Variables.launch_doc
16+
logging.debug("ReportPortal - Start Launch: {0}".format(
17+
launch.attributes))
18+
RobotService.start_launch(launch_name=Variables.launch_name,
19+
launch=launch)
20+
else:
21+
RobotService.rp.launch_id = Variables.launch_id
22+
23+
1224
def start_suite(name, attributes):
1325
suite = Suite(attributes=attributes)
1426
if suite.robot_id == "s1":
1527
Variables.check_variables()
1628
RobotService.init_service(Variables.endpoint, Variables.project,
1729
Variables.uuid)
18-
suite.doc = Variables.launch_doc
19-
logging.debug("ReportPortal - Start Launch: {0}".format(attributes))
20-
RobotService.start_launch(launch_name=Variables.launch_name,
21-
launch=suite)
30+
start_launch(suite)
2231
if not suite.suites:
2332
attributes['id'] = "s1-s1"
2433
start_suite(name, attributes)

robotframework_reportportal/model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class Suite(object):
77
def __init__(self, attributes):
88
super(Suite, self).__init__()
9+
self.attributes = attributes
910
self.suites = attributes["suites"]
1011
self.tests = attributes["tests"]
1112
self.doc = attributes["doc"]

robotframework_reportportal/variables.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Variables(object):
1515
launch_doc = None
1616
log_batch_size = None
1717
launch_tags = None
18+
launch_id = None
1819

1920
@staticmethod
2021
def check_variables():
@@ -38,6 +39,7 @@ def check_variables():
3839
raise RobotServiceException(
3940
"Missing parameter RP_PROJECT for robot run\n"
4041
"You should pass -v RP_PROJECT:<project_name_value>")
42+
Variables.launch_id = get_variable("RP_LAUNCH_UUID", default=None)
4143
Variables.launch_doc = get_variable("RP_LAUNCH_DOC", default=None)
4244
Variables.launch_tags = get_variable("RP_LAUNCH_TAGS", default="").split(" ")
4345
Variables.log_batch_size = int(get_variable("RP_LOG_BATCH_SIZE", default="20"))

0 commit comments

Comments
 (0)