Friday, June 23, 2017

Setting Up Own Device Farm

Device Farm Diagram






First of all, you need 2 tools and mobile devices:

You have to download selenium grid and make a node as selenium grid hub.
Command => java -jar selenium-server-standalone-2.53.0.jar -port 4444 -role hub

Now navigate to http://localhost:4444/grid/console  see selenium grid is functional.

Create a json file to configure the mobile devices

ssample json file,save this as deviceName.json file


{
    "capabilities": [
                     {
    "browserName":"iPad Air",
    "platformName": "iOS",
                     "maxInstances": 1,
                     "deviceName":"ipad Air"
                     }
                     ],
    "configuration": {
        "cleanUpCycle": 2000,
        "timeout": 30000,
        "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "host": "127.0.0.1",
        "port": 4726,
        "maxSession": 1,
        "register": true,
        "url": "http://127.0.0.1:4726/wd/hub",
        "registerCycle": 5000,
        "hubPort": 4444,
        "hubHost": "127.0.0.1",
        "hub": "127.0.0.1:4444/grid/register"
    }
}


Configuration Description
host : appium server host
port : appium server port

Now you have to run the following command to start the appium server with above config


appium --session-override --nodeconfig /Users/rifad/Desktop/iPad.json -p 4726 --bootstrap-port 2252 --udid 021YHB2133086676

You can register as many devices you want.
***********************

appium Rifad$ appium --session-override --nodeconfig /Users/rifad/Desktop/iPad.json -p 4726 --bootstrap-port 2252 --udid 021YHB2133086676
[Appium] Welcome to Appium v1.6.4
[Appium] Non-default server args:
[Appium]   port: 4726
[Appium]   bootstrapPort: 2252
[Appium]   sessionOverride: true
[Appium]   nodeconfig: /Users/indikat/Desktop/orderPad.json
[Appium]   udid: 021YHB2133086676
[Appium] Deprecated server args:
[Appium]   -U,--udid => --default-capabilities '{"udid":"021YHB2133086676"}'
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium]   udid: '021YHB2133086676'
[debug] [Appium] Starting auto register thread for grid. Will try to register every 5000 ms.
[Appium] Appium REST http interface listener started on 0.0.0.0:4726
[debug] [Appium] Appium successfully registered with the grid on 127.0.0.1:4444

***********************








You can now simply choose your device from appium capabilities and run the test on the desired device.

Sample Capabilities

capabilities.setCapability(MobileCapabilityType.UDID, DEVICE_UUID);
capabilities.setCapability(MobileCapabilityType.APP, APP_PATH_REALDEVICE);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "iPad Air");//Device name in selenium grid

capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, PLATFORM_NAME);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, PLATFORM_VERSION);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AUTOMATION_NAME);

capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
capabilities.setCapability(MobileCapabilityType.AUTO_WEBVIEW, true);
capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);


Note : This will be work on the same network or we have to disable the firewall for 4444 port if it in different network.











Wednesday, June 21, 2017

Appium Ios Automation

Skip to end of metadata

Requirements

  • Mac OS X 10.10 or higher
  • XCode >= 8.3.2
  • Apple Developer Tools (iPhone simulator SDK, command line tools)
  • Appium
  • Java latest version

Installing Xcode

  • Navigate to apple software downloads page Apple Downloads
  • Download Xcode and install
  • Download command line tools and install.

Install Java

Appium Installation

  • Install brew
    open command line terminal  in mac  and run the following command
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  • Install Node
    Open the terminal and run the following command
    $ brew install node

  • Install Appium
    npm install g appium@appiumversion
    eg : npm install g appium@1.6.5

  • Check Appium works 
    $appium
    If you install appium successfully you will see the following server log and you are ready start IOS automation.

   
     brew install libimobiledevice --HEAD 
           brew install carthage
     npm install -g ios-deploy


Running Your Test In Real IOS Device

  • You have to have your own .ipa file which is related to your application.
  • You should have the required certificated and provisioning profiles related to the development team.
  • Sample test without code modules.