by ITArray | Mar 17, 2017 | Appium, Automation, Mobile, QA, Testing, ui, Unit testing
Hello friends,
I work as a software test engineer already more than 6 years. And during these 5 years, I understood one thing – if You want to start to learn something new from the beginning, then You will Google for it. And as a result – You will find a lot of information without examples and simple explanation or You will find nothing at all, except some raw documentation.
I found that topics about mobile automation sometimes scare the people. So, I want to reveal the myths about mobile automation.
This article describes the simplest way of how to setup and run Your first test. An example is based on Appium 1.5.3 and Android system. It’s not about advanced usage of the latest version, etc.
What You need for starting with mobile automation
There are few thing that You need to have.
- Computer. MacBook is preferable to perform automation testing for iOS also.
- Pre-installed Android SDK or Android Studio is even better. Download here.
- Configured environment like for Selenium WEB testing.
- Appium desktop application latest version (1.5.3). Download here.
Base configuration
After downloading of Android Studio and setup of Android SDK You need to add the path to the folder with android SDK to the PATH of environments.
Run 1st test
- Create simple maven project in Eclipse or IntelliJ
- Add Appium dependency:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>2.2.0</version>
</dependency>
- Download test application that is used as an example. You can find it here or on Play Store here
- Create test class based on JUnit test framework and past the code inside:
public class PresentationTest {
private static final String MYREACTIONS_ID = "com.denyszaiats.myreactions:id/";
protected static DesiredCapabilities capabilities;
@Test
public void testPresentationTapGame() throws InterruptedException, MalformedURLException {
capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("deviceName", "emulator-5554");
capabilities.setCapability("app", {PATH_TO_APK_FILE});
AppiumDriver driver = new AndroidDriver(
new URL("http://0.0.0.0:4723/wd/hub"),
capabilities
);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElementById(MYREACTIONS_ID + "imageLangEn").click();
driver.findElementById(MYREACTIONS_ID + "skip_login_button").click();
driver.findElementById(MYREACTIONS_ID + "buttonGuideOk").click();
driver.findElementById("android:id/home").click();
driver.findElementById("android:id/home").click();
driver.findElementByXPath("//*[@text='Crazy Fingers']").click();
driver.findElementById(MYREACTIONS_ID + "buttonGuideOk").click();
driver.findElementById(MYREACTIONS_ID + "handButton").click();
driver.findElementById(MYREACTIONS_ID + "imageRightHand").click();
driver.findElementById(MYREACTIONS_ID + "fingerButton").click();
driver.findElementById(MYREACTIONS_ID + "imageIndexFinger").click();
driver.findElementById(MYREACTIONS_ID + "startButton").click();
WebElement tapButton = driver.findElementById(MYREACTIONS_ID + "imageTapButton");
int x = tapButton.getLocation().x + 50;
int y = tapButton.getLocation().y + 50;
for (int i = 0; i < 350; i++) {
driver.tap(1, x, y, 1);
}
String result = driver.findElementById(MYREACTIONS_ID + "resultsFasterClicker").getText();
assertEquals(result, "350");
}
}
- Open Android simulator. Or create a new Android simulator. Or connect Your Android test device. Do not forget to enable developer mode on Your real device.
- Open Appium desktop app and start it. Wait few seconds before Appium is ready to use. Run the test with JUnit.
This is it. Just several simple steps to run the simplest scenario with Appium.
I hope that now You’re confident with mobile automation and You know how to start with it.
Thanks for reading this article!
by ITArray | Jan 13, 2017 | Appium, Automation, QA, Selenium, Testing, ui, Visual Testing
Who said that Python is not friendly with Front-end?
ITArray released the 1st version of Automotion-Python framework that can be used for visual validation of the web and mobile application.
You can find it by link https://github.com/ITArray/Automotion-Python
If You want to connect the library to Your project with “Tox” – simply add this dependency to Your tox.ini file:
http://github.com/ITArray/Automotion-Python/tarball/master#egg=Automotion
It’s super simply in usage:
from automotion import responsive_ui_validator
ui_validator = responsive_ui_validator.ResponsiveUIValidator(self.driver)
result = ui_validator.init("Open navigation drawer scenario").find_element(self.driver.find_element_by_name("Name"), "Name")\
.same_size_as(self.driver.find_element_by_id("Id"), "Search Icon")\
.same_offset_bottom_as(self.driver.find_element_by_id("Id"), "Search Icon")\
.same_offset_top_as(self.driver.find_element_by_id("Id"), "Search Icon")\
.not_overlap_with(self.driver.find_element_by_id("Id"), "Search Icon")\
.inside_of(self.driver.find_element_by_id("Id"), "Toolbar")\
.width_between(100, 200)\
.height_between(100, 200)\
.draw_map()\
.validate()
ui_validator.generate_report("ReportToolbarIcons")
Leave Your feedback and comments. Also join and contribute into Automotion if You have ideas.
Thanks for reading my blog!
by ITArray | Nov 30, 2016 | Appium, Automation, Mobile, Selenium, Testing, ui
How many times You had a corrupted design after release?
It’s almost impossible to test manually on a big amount of devices that UI looks fine after some changes. So, let’s do it automatically.
Automotion – simple library for automation testing.
In the latest version was implemented powerful instrument for validation responsive UI on web or mobile pages.
by ITArray | Oct 27, 2016 | Appium, Automation, Development, QA, Selendroid, Selenium
Hello friends!
Most of engineers started to learn mobile automation with Appium. This is the most popular framework for mobile automation testing and I think that everybody agree with this. But sometimes it’s not enough to have only Appium, especially if we want to test native Android application with only WebView container inside. Appium cannot recognise elements in WebView container.
What to do in this case? Some test engineers decided to postpone with automation. But in reality this automation is even much easier than testing of native application with native controls.
How WebView container works? It’s loading mobile version of web site into custom WebView form. It means that we can easy inspect elements with Chrome or Firefox inspector.
But how to say Appium to search for elements exactly in this WebView? Many of You guys heard that need to switch context. But what if You run Appium inspector and You see only 1 context called NATIVE_APP ? In this case You need to switch Appium to Selendroid mode. For UI Appium inspector this is here:

But if we want to run the tests in Selendroid mode, we need to specify capability “automationName”: “Selendroid”.
After this You will see that You have more contexts than only NATIVE_APP, but also 1 or more WEBVIEW contexts. The next step is switching to correct context (for example):
driver.context("WEBVIEW_0").switchTo();
And that’s all. Now You can easy use the same methods like for Selenium WebDriver to navigate and click.
Also, You can use method .get(“url”) to easy navigate to any pages without clicking on UI.
Hope it will help You to solve some issues and start automation of hybrid apps.
Thanks for reading my blog!
Have a good automation!
by ITArray | Sep 15, 2016 | Appium, Automation, Development, Mobile, Selenium, Testing, Uncategorized
In this article I decided review simple Java library for automation testing that is successfully implemented already for many different projects.
So, let’s start.
What are the main problems that we have when we want to start automation testing on a new project? Usually there are:
- Which technologies to choose? Java, Python, C#, Ruby or maybe try with JavaScript? Yeah, each of technologies has benefits and limitations. And usually we don’t know what we will need in the future.
- What kind of application do we want to test? Mobile or Web or maybe Mobile-Web? Maybe we will require to test RESTful services or mail services?
- Need to write many validators from scratch. Need to organise the structure of capabilities, drivers, getters and setters for configurations.

So, I decided that need to write something that will help me to avoid such questions in the future. This “something” must be universal framework that can be easy connected to each project.
Now Automotion library is available on GitHub here
The main most useful functions that available in Automotion are:
- Super easy method for connection of WebDriver to the maven project. Support for Remote Web Driver and Appium Driver as well. Also it allows to run the tests in mobile simulation Chrome mode. You can update Your capabilities in the way You want. Also here is implemented methods for connection with SauceLabs.
- Powerful feature for performing HTTP(s) requests with attachments, authorisation, etc.
- Functions that allow to perform connection to IMAP mail services and verify mailboxes.
- Functions that allow to identify which of the languages are on the web and mobile pages. Support up to 70 languages.
- Smart text finder that allows to find even broken text. For example, You need to find the phrase “Try Again”, but You have recognised text like ” gh try gh 6%^7 hjgasd 7^& dfg!44d T@y GaIN#%hjk in”. People are able to find something similar to “Try Again”. It’s “T@y GaIN”. But machine cannot find it. So, this algorithm allows to find such phrases.
- Lots of useful helpers for the web and mobile automation testing:
- Different variations of scrolling and swiping for iOS, Android and Web
- Function that allow to hide keyboard on Android and iOS devices
- Different smart functions for clicking on the web or mobile elements. For example, if You need to click on the right top corner of element
- Functions for manipulating of network and settings on Android devices
- Smart functions for validation that elements on the page are aligned correctly. These functions are super useful for the validation of UI, especially header, footer and different static content.
All these functions could easy cover the most complicated cases in automation testing. With Automotion You don’t need anymore to look for the solutions. Everything is ready.
If You’re interesting to know more about Automotion library – feel free to contact with me directly. My email is available on the page About Me. Also, if You know another cases that could be added to Automotion – let me know or feel free to contribute on Github.
Thank You for reading this article and have a good automation!
by ITArray | Feb 12, 2016 | Appium, Automation, Mobile, Selenium, Testing, Unit testing
Sikuppium
Open source project which allows to mix Appium and Sikuli under one framework and easy manipulate by content and recognition of images. This is just a very nice helper in the automation testing to help test something that was left for manual visual testing. Now You can check without any problem in Your mobile automation project that correct Logo appears or correct photo is showed etc.
How to run
To run the sample test need to have pre-installed Maven 3 and Java 1.8 and need to execute next command from command line (example):
- PLATFORM_NAME=”android” APPIUM_VERSION=”1.4.13″ NAME=”MyReaction” PLATFORM_VERSION=”4.4″ DEVICE=”Nexus 5″ APP=”/Developing/Android/SignedApp/MyReaction.apk” mvn clean install
Please, specify correct path to the application which You can find in the folder “app” under the main parent folder of the project.
Current example is adapted for the devices with resolution of display: 768×1280, 1080×1920, 1200×1920.
How to take a correct images
To take a correct screenshots need to use a tool SikuliX. You cannot take a screenshot directly from simulator screen. Only crop from the screenshot provided by WebDriver API in class DriverScreen.java (line 22)
Help and contact
Also You can find the application My Reaction on Play Store https://play.google.com/store/apps/details?id=com.denyszaiats.myreactions
Link to GitHub project – http://dzaiats.github.io/appium-sikuli-driver/