reportportal / agent-Python-RobotFramework

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

Include multiple test suites in same Launch ID when tests are run in parallel through RobotFramework #61

Closed asubair closed 4 years ago

asubair commented 4 years ago

Actual:- Currently, Suppose if my test folder has multiple test suite files, running these test suite files parallel through pabot command will instantiate multiple launch ID's for each of the test suite.

Home ID User

Expected:- All these three suites IDPortal,UserPortal and HomePortal should show within same Launch ID

iivanou commented 4 years ago

@asubair Can you try changes from #62? Unfortunately, it's not possible currently to start launch automatically when using pabot. pabot does not provide any instruments to execute something before it starts test items/suites in subprocesses.

digaetan commented 4 years ago

We use pabot and we now just tested this new agent-Python-RobotFramework and found same issue.

We currently use with Report Portal 5.0.0:

And works well, meaning that we get only 1 Launch in Report portal even if pabot starts many thread processes...but we have another small issue with robotframework-reportportal-ng.

digaetan commented 4 years ago

Please note that in robotframework-reportportal-ng is possible to pass as comment to pabot/robot the existing launch ID:

--listener reportportal_listener:{launch_id}

With agent-Python-RobotFramework is not possible, so all robot sub-processes get own launch ID:

--listener robotframework_reportportal.listener

Maybe have a look at how is done https://github.com/peterservice-rnd/robotframework-reportportal-ng

iivanou commented 4 years ago

@digaetan robotframework-reportportal-ng is a different package. The package that is released in that repository is called robotframework-reportportal. From what I can see it is NOT possible to pass the ID of existing launch in the robotframework-reportportal-ng as well. There is no such instruction in docs: _--listener reportportal_listener:{launchid}. Please fill up issues for the robotframework-reportportal-ng at the corresponding repository.

digaetan commented 4 years ago

@iivanou yes I´m fully aware that robotframework-reportportal-ng is a different package. I was trying to point you there to see how they got it working with Pabot...as it works! we use it and we have a lot of Robot Framework test cases run in parallel with Pabot and 1 single Launch in report Portal which includes all test cases. Check for info here https://libraries.io/pypi/robotframework-reportportal-ng

iivanou commented 4 years ago

@digaetan Oke, I looked through the code and found what you mean. Unfortunately, the documentation says nothing about that option. As I mentioned above, the fix is provided in #62. @asubair Any updates regarding testing?

asubair commented 4 years ago

@iivanou I'll take a look and update

asubair commented 4 years ago

@iivanou Each test Suite still appear in separate launches

iivanou commented 4 years ago

@asubair How did you start pabot? Can you share the command line?

asubair commented 4 years ago

@iivanou pabot --processes 3 --listener robotframework_reportportal.listener \ --variable RP_ENDPOINT:http://x.x.x.x \ --variable RP_UUID:xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx \ --variable RP_LAUNCH:Smoke_Test \ --variable RP_PROJECT:smoke_tests *.robot

iivanou commented 4 years ago

@asubair You should add one more variable that indicates launch ID where your tests are goona be reported to like --variable RP_LAUNCH_UUID:"your_launch_id".

asubair commented 4 years ago

@iivanou Now it works! Steps:- Fetch the Launch_ID by calling the API eg:-

curl --header "Content-Type: application/json" \
     --header "Authorization: Bearer 039eda00-b397-4a6b-bab1-b1a9a90376d1" \
     --request POST \
     --data '{"name":"rp_launch","description":"My first launch on RP","startTime":"1574423221000","mode":"DEFAULT","attributes":[{"key":"build","value":"0.1"},{"value":"test"}]}' \
     http://rp.com/api/v1/rp_project/launch

Pass this Launch_ID as value for RP_LAUNCH_UUID

pabot --processes 3 --listener robotframework_reportportal.listener \ --variable RP_ENDPOINT:http://x.x.x.x \ --variable RP_UUID:xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx \ --variable RP_LAUNCH:Smoke_Test \ --variable RP_LAUNCH_UUID:"Launch_ID" \ --variable RP_PROJECT:smoke_tests *.robot

For reference:- How to start a new launch? https://github.com/reportportal/documentation/blob/master/src/md/src/DevGuides/reporting.md#start-launch

abhijitlocus commented 2 years ago

@iivanou @asubair reports are not reflecting on the portal, can you suggest if i am doing something wrong?

i am using - robotframework==4.0.2 robotframework-pabot==2.0.1 robotframework-seleniumlibrary==4.2.0 robotframework-reportportal-ng==2.0.0 robotframework-reportportal==3.0

running command - xvfb-run '--server-args=-screen 0 1920x1080x24 -ac' pabot --processes 3 --listener reportportal_listener --variable RP_ENDPOINT:https://reportportal.*****.com/ --variable RP_UUID: --variable RP_LAUNCH: --variable RP_LAUNCH_UUID: --variable RP_PROJECT:** test.robot

iivanou commented 2 years ago

@abhijitlocus Remove robotframework-reportportal-ng package and try again. Also, you should update robotframework-reportportal to the latest version.