Posts

Showing posts from 2015

Start & Stop Appium Server Programmatically using Java (MAC OSX)

Image
Appium is widely used for mobile automation these days. You have to have your Appium server up and running before you can run your automated Appium tests. Most of the times, the test engineers ensure that the Appium server is running before they start executing the test suite. But this arrangement won’t work if you want to run your Appium tests in Continuous Integration/Deployment.

In this post, we will see how to start & stop Appium server programmatically using Java. This code is for Mac OSX (10.10). In next article we will see how to start & stop Appium server programmatically using Java on windows.

So here is the code Create a class called AppiumServer and paste the code mentioned below
Loaded using https://gist.github.com/rightqa/81e60d6540098817480b...
In your test class, before you set driver capabilities, start the Appium server like the following

Appiumserver server=new Appiumserver(); 
System.out.println("---- Starting Appium server ----"); 
server.startServe…

Install & Setup Android SDK and ADB on Mac OSX

Image
We have already seen how to install and configure Android SDK on windows. In this post we will see how to install and configure Android SDK and ADB on Mac OSX. We are using Yosemite (Mac OSX 10.10) while writing this post.
Go to http://developer.android.com/sdk/installing/index.htmlClick and download “STAND_ALONE SDK TOOLS”  The downloaded file will be a zip file with name like “android-sdk_r24.3.3-macosx.zip” (NOTE: version number could be different based on when you are downloading) Unzip the downloaded file and rename it with something shorter, say “android-sdk”Move the “android-sdk” directory to a location of your choiceThe Android SDK archive initially contains only the basic SDK tools. It does not contain an Android platform or any third-party libraries. We need to download them.To download the necessary filesStart your terminalNavigate to the location where you have your android-sdk folder (#5 above)Navigate to tools folderWrite “android” and hit returnAndroid SDK manager will s…

Sending keyboard input via ADB to your android device

Image
Say you are writing an Appium test for Android and you are required to interact with native Android keyboard. Let’s take a test scenario
Launch the applicationTap on the Search bar/box/buttonEnter the search termTap on Enter key on native Android keyboard. How would you do this? We will focus on the last action of tapping “Enter” key on Android keyboard.
It could be simply done by using something called “SendKeyEvent”
driver.sendKeyEvent(key);

Now, how do you know about the key you want to pass to “SendKeyEvent”? Below is the list (table) of keys for your reference.

To verify that it works in your script, you can check them using ADB. Assuming you have your Android SDK properly installed and configured, you can do the following.
Open command prompt (on windows)Use command “adb devices” to make sure that the devices you want to interact with is available in the list returned by adbThen you can endter “adb shell input keyevent <keycode>” use <keycode> from the below table as pe…

Appium desired capabilities for iOS

In our previous post, we saw Appium desired capabilities specific to Android. Here we have listed all the desired capabilities for iOS. Most of them are optional capabilities, but these will come handy when you are writing full blown test automation for iOS. Appium desired capabilities - iOS OnlyCapabilityDescriptionValuescalendarFormat(Sim-only) Calendar format to set for the iOS Simulatore.g. gregorianbundleIdBundle ID of the app under test. Useful for starting an app on a real device or for using other caps which require the bundle ID during test startup. To run a test on a real device using the bundle ID, you may omit the 'app' capability, but you must provide 'udid'.e.g. io.appium.TestAppudidUnique device identifier of the connected physical devicee.g. 1ae203187fc012glaunchTimeoutAmount of time in ms to wait for instruments before assuming it hung and failing the sessione.g. 20000locationServicesEnabled(Sim-only) Force location services to be either on or off. De…

Appium desired capabilities for Android

In our previous post, we understood about Appium desired capabilities. Appium supports Android, iOS and FirefoxOS platforms, hence there are some platform specific desired capabilities.

Here we have listed all the desired capabilities for Android. Most of them are optional capabilities, but these will come handy when you are writing full blown test automation for Android.
CapabilityDescriptionValuesappActivityActivity name for the Android activity you want to launch from your packageMainActivity, .SettingsappPackageJava package of the Android app you want to runcom.example.android.myApp,
com.android.settingsappWaitActivityActivity name for the Android activity you want to wait forSplashActivityappWaitPackageJava package of the Android app you want to wait forcom.example.android.myApp,
com.android.settingsdeviceReadyTimeoutTimeout in seconds while waiting for device to become ready5androidCoverageFully qualified instrumentation class. Passed to -w in adb shell am instrument -e coverag…

Appium Desired Capabilities

We have seen how to write Appium test for Android. Actually it’s NOT an actual test. If you see in that post, we run it as a JAVA APPLICATION. But before we write an actual test (or a meaningful test) we need to understand more about Appium desired capabilities.

Here we will explain what are Appium desired capabilities and why do we use them. But before we dive in the details, we will have to brush up our understanding about Appium architecture. You can read detailed post here.

We know that the Appium server does the following (in addition to other things that it does)
Receives connections from a client and creates a session So what is a Session? (In terms of Appium automation) Automation is always performed in the context of a session. When a client initiates a session with Appium server, it basically sends a POST/session request to the Appium server, with a JSON object called the ‘desired capabilities’. Appium server receives the connection and start up the automation session. Appium…

Writing first Android test using Appium

Image
In this post we will see how to write an automated test for Android using Appium in JAVA. We presume you have all the necessary setup already done. If NOT, you can get the setup done and then continue writing the test.
Before writing our first test, you should have the following prerequisite in place
JDK InstalledAndroid SDK InstalledAppium ServerEclipse IDE and maven plugin installedActual Android app to be tested.  You don’t have a test app? Don’t worry! Appium provides pre-compiled test apps for you to get started. You can download the Android app(“api.apk”) from here.
Just note down the location where you download the test app, you will need it later on. Start eclipse (by double clicking the eclipse.exe in the eclipse folder or by the desktop shortcut, you might have created!)Click on File > New > Other >Select Maven > Maven project in the wizard (If you don’t see Maven, it means your maven plugin is NOT properly installed)Select the Workspace location (if you want a pa…

Download Eclipse and install Maven - Eclipse Plugin

Image
In our previous posts, we have been setting up our system to write our tests for mobile apps using Appium. We have seen how to install JDK. We also saw how to install Android SDK and we have installed Appium. Now it’s time to have an IDE to write our actual tests.

To begin with, we will write our tests in Java. And we will use Eclipse as our IDE. Additionally we will use Maven to manage all our project dependencies. So will see how to install maven as an eclipse plugin.

Getting eclipse and running is pretty simple
Go to eclipse download page and download the standard eclipse package (based on your machine configuration – 32-bit or 64-bit. Once downloaded, extract the content of the folder.When you open the extracted contents folder, you will see eclipse.exeDouble click eclipse.exe and you will have eclipse running :) (TIP: Create a desktop shortcut for eclipse.exe and you will be able to access it easily from your desktop) 
(TIP2: When you start eclipse, you will see an option to selec…

Getting started with Appium - Installing Appium on windows

Image
In our previous posts, we have seen how to install JDK and Android SDK, now it’s time to download Appium.

The easiest way to get started with Appium on windows is to download the latest version of Appium from the website – http://appium.io/ Click on “Download Appium”You will have a zip file downloaded.Alternatively, you can also go here and download “AppiumForWindows.zip”Extract the content of the downloaded zip file and you will see “Appium.exe” in the folder.Double click the “Appium.exe” and you will see a GUI to start Appium serverClick on the start button you will have your Appium server, up and running
Once the Appium server is running, you will see some logs in the Appium GUI window.
Also, you can go to http://localhost:4723/wd/hub/status and see similar logs, which indicates that your Appium server is up and running.

What it means is that your Appium server is up and running on ready to listen any commands you send.

If you are just beginning with mobile automation, using the Appi…

Step by step guide to setup Appium for Android - Windows - Part 2

Image
To start writing automated tests for your app, using Appium, we need to do some setup beforehand. We will need the following setup before writing our tests.
JDK (Java Development Kit) installationAndroid SDK installation (This post)Appium installationIDE of your choice (to write the actual tests) This post will be a part of your step by step guide to setup Appium for Android on Windows OS.
We have already seen JDK installation in our previous post. Here we will continue from where we left. We will do the Android SDK installation.
Android RequirementsAndroid SDK API >= 17 (Additional features require 18/19)Appium supports Android on OS X, Linux and Windows. For the scope of this post, we will consider Appium for Android on Windows



Go to Android developer’s site and download the Stand-alone SDK toolshttp://developer.android.com/sdk/installing/index.html Android is now officially ending its support for Eclipse ADT plugin, hence we recommend using the stand-alone SDK tools. Download the …

Step by step guide to setup Appium for Android - Windows - Part 1

Image
Now that we have understood about Appium and its architecture, it’s time to actually write some automated tests for mobile applications. But before we write some tests we will have to get all the installations done. This post will be your step by step guide to setup Appium for Android on Windows OS.

We will need the following setup before writing our tests.
JDK (Java Development Kit) installationAndroid SDK installationAppium installationIDE of your choice (to write the actual tests)NOTE: You can skip one or more steps mentioned below if you already have the necessary installations done.
JDK (Java Development Kit) installation Go to Java download page This page will have the latest JDK version available for download. Download and install the latest version from here.
If you want older version say JDK 7 – You can download from here Click on “DOWNLOAD” for JDKAccept the license agreement (select the radio button) and choose the JDK file as per your OS (Since we are doing this step for win…

An introduction to Appium architecture

Image
In our last post, we gave a quick introduction to Appium. We explained what Appium is and its philosophy. Here we will take a look at Appium architecture.

Appium uses the vendor-provided automation frameworks under the hood. Because of this, we don’t need to compile any Appium specific or third-party code or frameworks to the app under test. This is the base of the first philosophy of Appium, you're testing the same app you're shipping. The vendor-provided frameworks that Appium uses are
iOS: Apple’s UIAutomationAndroid 4.2+: Google’s UIAutomatorAndroid 2.3+: Google’s Instrumentation (Support for Instrumentation is provided by a separate project – Selendroid) Appium at its core is a webserver written in Node.js that exposes a REST API. The Appium server does the following
Receives connections from a client and creates a sessionListens to the commandsExecutes the commands (on real devices or emulators)Responds back with a HTTP response representing the results of the executed com…

Introduction to Amazon Device Farm

Image
We know that testing on mobile devices can be a challenge considering the variations in devices available these days. The broad range of devices, manufactures, models, operating systems, different versions of the same operating system, screen sizes makes it seemingly impossible to create an extensive test matrix. Also having a wide range of physical devices is NOT possible for every app developer. As a result, many app developers compromise on their testing or limit themselves to a smaller market by catering to a smaller subset of available devices. So what’s the solution? AWS Device Farm! (There are other device farms available as well, but this post is about AWS Device Farm!)

In early July 2015, Amazon Web Services (AWS) unveiled their new device farm, called Amazon Device Farm. Mobile app developers will be able to test apps quickly and securely on real Android and Fire OS smartphones and tablets using the Amazon device farm. At the time of writing this post, the device farm suppor…

An introduction to Appium

Image
We have already seen key challenges in testing mobile apps and a comparison of some open source mobile automation frameworks. RightQA uses Appium extensively to provide mobile test automation to its clients. So we thought of giving you a quick introduction to Appium.


There are 3 kinds of mobile applications
Native apps: The apps that are written using the SDK provided iOS or Android. These are the apps you download from corresponding app stores (App store or Google play). Web apps: Web apps are basically web applications that you access using your phone’s web browser (Safari, Chrome or phone’s built-in browser). The web pages/applications are optimized to work well on mobile devicesHybrid apps: As the name suggests, these apps are combinations of Native and web apps. Hybrid apps are basically a wrapper around the webview. Webview is a native control that allows interactions with web content.So, what is Appium?
Appium is an open-source tool for automating native, hybrid and web apps on …

Mobile testing tools – 6 open source frameworks compared

Image
We have already reached a point where mobile usage has surpassed PC usage. Companies are developing more mobile products than ever before. Hence, testing mobile products has become inevitable. We have already seen key challenges in testing mobile apps. So, if there are challenges in testing mobile apps, then what’s the solution? Mobile Automation!

Why should you do mobile automation?
To release a better product to market, testing is a MUST. Failure to identify and resolve bugs can cost companies thousands of dollars a day and frustrate existing users. The reasons why you should be automating your mobile tests are as follows:
Speed of TestingMore test coverageEarly defect detectionRegression can be automated so the testers can focus on edge casesMore test coverageRelease with confidenceTesting of software on different platforms or with different configurationsLong term ROIAutomation is an absolute, hands-down success is in a continuous integration environment   Below is a list of open so…

5 Key challenges in testing mobile apps

Image
Most of the big companies have their own mobile app or their website is optimized for mobile. New companies are taking the mobile first approach. In many cases, their mobile app is the only way customers interact with their products. Companies rely heavily on mobile apps to drive their business. This proves Benedict Evans point – Mobile is eating the world – Mobile is eating the world :)

Now, if mobile is the main business driver, it’s no surprise that developing, testing and releasing quality apps efficiently and quickly is very important for most of the organizations. A poor quality app can cause revenue loss in addition to damage to brand reputation to the organization. A thorough test strategy needs to follow in order to get the apps in good shape, reach market on time, within budget and works well across a range of devices and OS distributions.

RightQA is focused on mobile testing and has identified 5 key challenges that app developers and testers face.

The never-ending list of dev…