Test driven development using Appium.


Brief:

Some of the clients asking us to do Test  Driven Development and we are doing his by using the Appium. We are doing the Test  Driven Development for both the mobile platform (Android, iOS).
  • It required some software installation to run.
  • Required softwares JDK, JRE, Eclips(Mars), Appium(1.4.13), Maven, Selenium web driver, junit jar.
  • We need to create Test script using TestNG class in eclips. 
  • Once run single test script it will open simulator automatically and run the script using ipa file which we want.
How It Works:

Client/Server Architecture:
 
Appium is at its heart a web server that exposes a REST API. It receives connections from a client, listens for commands, executes those commands on a mobile device, and responds with an HTTP response representing the result of the command execution. The fact that we have a client/server architecture opens up a lot of possibilities: we can write our test code in any language that has a http client API, but it is easier to use one of the Appium client libraries. We can put the server on a different machine than our tests are running on. We can write test code and rely on a cloud service like Sauce Labs to receive and interpret the commands.


Session:
 
Automation is always performed in the context of a session. Clients initiate a session with a server in ways specific to each library, but they all end up sending a POST /session request to the server, with a JSON object called the 'desired capabilities' object. At this point the server will start up the automation session and respond with a session ID which is used for sending further commands.


Desired Capabilities:
 
Desired capabilities are a set of keys and values (i.e., a map or hash) sent to the Appium server to tell the server what kind of automation session we're interested in starting up. There are also various capabilities which can modify the behavior of the server during automation. For example, we might set the platformName capability to iOS to tell Appium that we want an iOS session, rather than an Android one. Or we might set the safariAllowPopups capability to true in order to ensure that, during a Safari automation session, we're allowed to use JavaScript to open up new windows. See the capabilities doc for the complete list of capabilities available for Appium.


Appium Server:
 
Appium is a server written in Node.js. It can be built and installed from source or installed directly from NPM: $ npm install -g appium $ appium

Appium Clients:
 
There are client libraries (in Java, Ruby, Python, PHP, JavaScript, and C#) which support Appium's extensions to the WebDriver protocol. When using Appium, you want to use these client libraries instead of your regular WebDriver client. 


Following are the steps to use Appium for launching test cases

APPIUM:

1. Open Appium and Click on apple symbol.
2. Enter the Path of IPA file to be tested.
3. Check 'force device' check box and select the connected device from drop down list. Also select the iOS version of connected device from platform version drop down list. (If version and device not available in list type it manually).
4. If you are testing on real device check UDID check box and enter UDID of the device.(Be sure that you have application installed on device while testing on device)
5. Check no reset check box.
6. Now go to Settings menu next to apple logo.
7. Check Override Existing Sessions.
8. Now you can click on launch.


ECLIPSE:

1. Open the eclipse workspace.
2. You have to run just one file i.e. testng.xml, before that it is necessary to look at appium log. You should run testng.xml file only after you get
"info: [debug] Responding to client with success:" message in appium log.

3. Now right click on testng.xml->Run As->TestNG Suit.

Boston Byte Grabs a Spot in Clutch’s List of Top Software Developers in Massachusetts

Boston Byte is a collective of highly-skilled and highly-professional developers dedicated to solving your technological ...