reportportal / agent-Python-RobotFramework

Robot Framework integration for Report Portal
Apache License 2.0
59 stars 33 forks source link

SauceLabs Support #98

Closed pako88 closed 3 years ago

pako88 commented 3 years ago

It is possible to link a report portal testcase to a saucelabs session. For this, an attribute needs to be added to the report portal test case with key "SLID" and value "Selenium Session Id = Sauce Labs Session Id"
You can find more information here: https://reportportal.io/docs/Sauce-Labs-integration%3Ehow-to-use-sauce-labs-integration

Is there any plan to add this feature to this agent?

iivanou commented 3 years ago

@pako88 It is already available in the agent. Not in PyPi version but in the master branch. Just add SLID:XXXXXXXX(without whitespaces) to the list of test case tags.

pako88 commented 3 years ago

@iivanou but this has to be done somehow dynamically - so the agent has to detect the session id. isn't it?

iivanou commented 3 years ago

@pako88 I'm not familiar with Sauce Labs. The only thing I can suggest you is passing SLID through the command line option --variable RP_TEST_ATTRIBUTES:"SLID:XXXXXXXX". Or you can create a PR with functionality that gets the ID via Python code.

pako88 commented 3 years ago

ok, thanks @iivanou passing it is no option because selenium ids will be generated in runtime. but i just found the robot framework keyword "Set Tags" - i'll try to find a way setting the tags dynamically

iivanou commented 3 years ago

@pako88 If Set tags fits for the purpose, then the agent code needs to be updated as well. The agent will have to check tags at the beginning of the test and at the end of the test. And in case of inconsistency update test tags.

pako88 commented 3 years ago

@iivanou it is possible. i can update the tags with the session id in runtime with following snippet:

from robot.libraries.BuiltIn import BuiltIn
...
BuiltIn().set_tags("SLID:{}".format(self._sel.driver.session_id))

Can you update the agent accordingly?