0

How to properly quit the automation session when running Robot Scripts?

I’m new to App automation. I was trying to automate one of my iOS application with Robot Framework and my setup was configured for running my test on a browser stack’s device.


The following is my sample script.


*** Test Cases ***
    
Open App
    Open Application    ${Remote_Url}   platformName=${PlatformName}    deviceName=${device}
  ...  platformVersion=${os_version}    app=${app}  name=${name}    build=${Build}  orientation=${Landscape}
  ...   autoAcceptAlerts=${AutoAcceptAlerts}  browserstack.idleTimeout=${browserstack.idleTimeout browserstack.appium_version=1.21.0
  
Login in to app
    
    Input Text    id=txt-username   my_username
    Input Text    id=txt-password   my_username
    Click Element    id=btn-login

    Wait Until Page Contains Element  id=img-userprofile
    Sleep   5
        
Close the app
    
    Quit Application

But when I execute this script, it performs the automation steps perfectly, but the test status in the browser stack console is shown as "TIMED OUT" (Please see the second item in the below screenshot)

if I do the same automation steps via Appium Inspector, then the browser stack will treat this test as "Passed" and its status will be displayed as "UNMARKED" (the first item in the below screenshot).

browser stack session

I looked through the Robot Framework Appium library documentation and couldn't find any useful ways for terminating a session. So, could someone kindly tell me how to properly close a session and how to set the session status with respect to test result (my success/failure)?

1 Answer 1

0

You can use the below to end the session on BrowserStack

*** Test Cases ***
Appium Test on BrowserStack
        Open Application    ${REMOTE_URL}    app=%{BROWSERSTACK_APP_ID}    name=single_test    build=RobotFramework    platformName=iOS    os_version=11.0    device=iPhone 8 Plus
    # accessibility id=Alert Button
    Click Element    id=Alert Button
    # accessibility id=OK
    Click Element    id=OK
    Close Application

For your reference, below is the sample repository which you can use.

https://github.com/nithyamn/bstack-robot-framework/tree/master/app/test

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you Sachin, your solution works fine!! It was actually mentioned in the documentation but some how I missed it :( Thanks again for your help!
Also I'm curious to know how should I set the status to "PASSED" or "FAILED" (instead of showing "UNMARKED")? Kindly advise if you have any solution for this too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.