Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com

Android: how to start a script on more than one device?

How to start over ant script on more devices or emulators?

Best Answer

  • edited September 2019 Answer ✓
    Hi Duka,

    Please follow the steps below to run the scripts on multiple devices/emulators in parallel.

    - Get the device ids of all the devices using 'adb devices'
    - Edit the <SahiPro>/userdata/config/android_device.xml like below.
    <androidDevice> 
    		<name>motorola</name> 
    		<displayName>Moto E5</displayName>
    		<deviceId>c7e6dd41</deviceId>
    </androidDevice>
    
    <androidDevice> 
    		<name>motorola</name> 
    		<displayName>Moto G5</displayName>
    		<deviceId>ZF6222MNMD</deviceId>
    </androidDevice>
    

    - Here, please make sure that you have the same name in <name> tag. Ex. motorola in this case and deviceid should be of different devices Ex. c7e6dd41 and ZF6222MNMD

    Save the changes, restart Sahi.

    Now, create the suite of scripts which are intended to run on the android device. Please make sure that you have not hardcoded the device id in the script.
    _setMode("ANDROID");
    _connectDevice();  //no hardcoded device id.
    _selectDevice(); 
    

    - Open the suite in Sahi Pro Script Edtior
    - Click on Playback option and select 'motorola' device in Android Device. Keep threads to 2 or more
    - You can directly run the script or you can create an ant targets and run the suite.

    Please let us know if you face any issues, you can mail to support at sahipro dot com

Answers

Sign In or Register to comment.