How to quit appium test session using Robot Framework?

846 views Asked by At

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

There are 1 answers

2
Sachin On BEST ANSWER

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