pythonpytestreportportal

Get reportportal url result after pytest execution


Is there a way to get report portal report link after test execution is done?

I exectue the tests as such: pytest --reportportal

which indeed generates a report on ui level, but nothing in cli or anywhere that i can get it via a script to post it to slack after exec


Solution

  • I'm using following method in pytest_runtest_makereport:

    config.py_test_service.rp.get_launch_ui_url()
    

    Actually config.py_test_service.rp is available from request fixture also.

    Also it could be made from RP client properties like this:

    "RP launched at {}/ui/#{}/launches/all/{}".format(
                request.config.py_test_service.rp.endpoint,
                request.config.py_test_service.rp.project,
                request.config.py_test_service.rp.launch_id)