Forum Discussion

jqa-smokeball's avatar
jqa-smokeball
Occasional Contributor
2 years ago

Bitbar Mobile Automation - Keep connection alive for remote mobile device?

I've started a mobile automation project in Testcomplete using keyword scripting. However I've noticed that after an hour of run time, the remote mobile device gets disconnected. Is there anyway to keep the connection alive until the whole test suite has been completed?

 

 

4 Replies

  • KB1's avatar
    KB1
    Champion Level 2

    There are a few ways to keep the connection between the remote mobile device and TestComplete alive for the duration of your test suite:

    1. 1. Increase the timeout values for the connection: You can increase the timeout values for the connection between TestComplete and the remote mobile device in the project's options. This will prevent the connection from timing out prematurely.

    2. 2.Keep the device screen on: You can use the device's settings or an app like "Keep Screen On" to keep the device screen on during the test run. This will prevent the device from going into sleep mode and disconnecting.

    3. 3. Use a keep-alive method: You can use a keep-alive method such as sending a ping command to the device at regular intervals to prevent the connection from timing out. This can be implemented in your test script.

    It's also good idea to check the log files of the device to see what is causing the disconnection and troubleshoot the issue.

    • jqa-smokeball's avatar
      jqa-smokeball
      Occasional Contributor

      Thanks for the idea KB1 , just wanted to confirm more info in regards to the following:

      >> #1 Increase the timeout values for the connection: You can increase the timeout values for the connection between TestComplete and the remote mobile device in the project's options. This will prevent the connection from timing out prematurely.


      I would just like to kindly confirm if you meant the Options > Project Properties > Playback > Runtime? I've already updated this to longer intervals but the device still disconnects

       

      >> #2 Keep the device screen on: You can use the device's settings or an app like "Keep Screen On" to keep the device screen on during the test run. This will prevent the device from going into sleep mode and disconnecting.

      I've also ran the entire test suite while showing the mobile device screen and the bitbar mobile device still disconnect intermittently around and 45-60 mins

       

      >> 3. Use a keep-alive method: You can use a keep-alive method such as sending a ping command to the device at regular intervals to prevent the connection from timing out. This can be implemented in your test script.

      I've tried searching for the community in regards to how to implement this but wasn't able to find any details, this is the only method I haven't tried and would like to kindly ask if you could share info on how to implement. Thanks!

  • KB1's avatar
    KB1
    Champion Level 2

    >>>>I've tried searching for the community in regards to how to implement this but wasn't able to find any details, this is the only method I haven't tried and would like to kindly ask if you could share info on how to implement. Thanks!

    In Bitbar, you can implement a keep-alive method by sending a "ping" command to the device at regular intervals using a scripting language supported by Bitbar, such as Java, Python, Ruby, etc.

    Here's an example in Python:

     
    import os
    import time
    
    while True:
       response = os.system("ping -c 1 google.com")
       if response == 0:
          print("Google is up")
       else:
          print("Google is down")
       time.sleep(60) # waits for 60 seconds before sending the next ping

    This script will send a "ping" command to "google.com" every 60 seconds and check if the response is successful or not. You can replace "google.com" with the device's IP or hostname you want to keep alive.

    >>>> I would just like to kindly confirm if you meant the Options > Project Properties > Playback > Runtime? I've already updated this to longer intervals but the device still disconnects

    Yes, you are correct, the option I was referring to is the "Project Properties > Playback > Runtime" in TestComplete. You could also try checking for potential network issues such as firewalls or proxies that may be interfering with the connection.




  • KB1's avatar
    KB1
    Champion Level 2

    You can also try checking the Bitbar forum for solutions. I'm not an expert in Bitbar. hahha

    Edit: Accidentally posted the wrong link.