1

Please find the code below that I have added in environment.py file for after_scenario I do not get any error but neither are my tests marked with appropriate status on Browserstack

def after_scenario(context, scenario):
if scenario.status == Status.failed:
    requests.put(
        "http://Username:Key@hub-cloud.browserstack.com/automate/sessions/iOS-Appium.json".format(
            context.driver.session_id),
        json={"status": "completed", "reason": "Test Failed"})
else:
    requests.put(
        "http://username:Key@hub-cloud.browserstack.com/automate/sessions/iOS-Appium.json".format(
            context.driver.session_id),
        json={"status": "completed", "reason": "Test Pass"})

2 Answers2

0

You could refer to the sample test in the link: https://gist.github.com/shawnlobo96/d7bea74b13556973146abbd900c5c4a9 and implement this at your side on similar lines.

ANM1996
  • 161
  • 3
0

The REST API for appium is as follows, changing the API call made fixed the issue

"http://'+username+':'+access_key+'@api-cloud.browserstack.com/app-automate/sessions/{}.json".format(
        context.driver.session_id), data={"status": "completed", "reason": "Test Failed"})