Reconnect Mobile Session

Since version 6.2 Rapise is able to reconnect mobile sessions. It makes possible many usage scenarios that save a lot of time because you do not need to relaunch the application and perform manual steps to reach desired application state.

Maintenance Scenario

  1. You run a test and it fails at some point because some object is not found on screen.
  2. You use the Mobile Spy to reconnect to the application and analyze the cause of the failure.
  3. You use the Mobile Spy to re-learn the object.
  4. You run the test exactly from the step where it stopped working to make sure the test is fixed.

Multi Session Recording Scenario

  1. You record first steps of a test case.
  2. You run the test to make sure it works as expected (optional).
  3. You start next recording session and reconnect to the application. No time is wasted for launching the application and performing steps manually to prepare it for recording.

Reusing Session to Run Multiple Tests

Since application launch is time consuming operation in mobile testing you may run multiple tests on the same application instance.

  1. You run a test and it leaves the application running.
  2. You run next test and so on.

This approach has pros and cons. We do not recommend to use it for completely independent test cases. It makes sense, however, to use it to break down a long test into separate modules and run them sequentially.

How it Works

To leave application running and save session information use AppiumDriver.SaveSession call in TestFinish block of your test.

function TestFinish()
{
    AppiumDriver.SaveSession();
}

To reconnect to the running application use AppiumDriver.ReconnectSession call in TestPrepare block of your test.

function TestPrepare()
{
    AppiumDriver.ReconnectSession();
}

If you want Rapise to launch a new application session if there is no saved one pass true to AppiumDriver.ReconnectSession call.

function TestPrepare()
{
    AppiumDriver.ReconnectSession(true);
}

Note: TestPrepare block is executed when you do recording or execution of a test. It is also executed if you do selective execution of RVL (Play Selection, Play From Here, etc.).

Active Session

When you launch a Mobile Spy from the main toolbar it first checks if Appium server has active sessions. If there are active sessions then the Spy connects to one of them. You may switch the session using the dropdown on the spy toolbar.

See Also