[Beta Version]

Last Updated: 18/Jan/2017

Index

1.     Note

2.     Why Automation

3.     Why Appium

4.     How Appium Works

5.     Appium Desktop Client

6.     API ( Ruby )

7.     SCM , CI

8.     Efficient Ways of Bugs Tracking & TC Management – My Views

9.     Appium Project Bugs Reporting

10.   Useful Tools ( WIP )

11.   Useful Links ( WIP )

12.   Elements Locator Strategy

13 .  Grid Setup   ( WIP )

14.   Continuous Integration

Mark Watney Quote from The Martian movie At some point, everything’s gonna go

south   on you and you’re going to say, this is it. This is how I end. Now you can either

accept that,   or you can get to work. That’s all it is. You just begin. You do the math. You

solve one  problem and you solve the next one, and then the next. And If you solve enough

problems,   you get to come home.” [ so true; in everyday’s work of Automation Engineer ]

1. Note:

I’m from Web Automation background , working with Selenium + Java.

                Because of circumstance / compulsions had to use Ruby for Mobile Automation 🙂 But I feel it’s always good to have knowledge of one of the scripting language as well.

                This blog post is to share my learnings about Appium + Ruby, Java for Android & iOS automation native app UI automation.

2. Why Automation

If you and/or your boss/management is/are convinced about automation , then only do it otherwise it won’t be value add to yourself or project or company

Ok; below are the reasons why “I” ( was, am & will be convinced to ) do automation

– has got hundreds / thousand of test cases which need to be run on multiple devices , OS versions, multiple times as well

– can’t do it manually each time , as it’s boring and waste of manual time , energy etc

– Developers , Product Owner , Management wants quick ( as early as possible by a good QA engineer ) feedback on health of s/w

– just automate whatever is possible and run daily basis

3. Why Appium ?

– As it’s used by majority of companies ( Job Sites are easier way to find out which tools are used by majority of the companies 🙂 )

– It’s based on Selenium 2.0 , thus easy to get started in case you’re from web automation background

4. How Appium Works ?

( http://appium.io/introduction.html?lang=en )

http://nishantverma.gitbooks.io/appium-for-android/content/appium/why_appium.html – image

Appium – node.js server

Test Cases – any language supported by Selenium WebDriver API

AUT ( Emulator / Simulator / Device ) –  takes the Selenium commands from your test code and translates them into a readable format for UIAutomator, using the WebDriver JSON Wire Protocol.

Client/Server Architecture

Appium is at its heart a webserver that exposes a REST API.

1.1 It receives connections from a client

1.2 listens for commands

1.3 executes those commands on a mobile device

1.4 responds with an HTTP response representing the result of the command execution


we can write our test code in any language that has a http client API

e.g.

info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)

info: Appium REST http interface listener started on 0.0.0.0:4723

info: Console LogLevel: debug

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.

e.g.

info: –> POST /wd/hub/session {“desiredCapabilities”:{“platformName”:”iOS”,”platformVersion”:”9.2″,”udid”:”dc84c00dc6807d13d0997ee802e7faa4a26f65ba”,”deviceName”:null,”newCommandTimeout”:999999,”app”:”/Users/vikram-anna/Library/Developer/Xcode/DerivedData/wunderlist-ddifxljcmzpfdfgvqrmvjoepiisx/Build/Products/Development-iphoneos/Wunderlist.app”,”automationName”:”Appium”,”waitForAppScript”:”$.delay(3000); $.acceptAlert();”,”autoDismissAlerts”:true,”nativeInstrumentsLib”:true}}

info: Client User-Agent string: appium/ruby_lib/8.0.0

info: [debug] Using local app from desired caps: /Users/vikram-anna/Library/Developer/Xcode/DerivedData/wunderlist-ddifxljcmzpfdfgvqrmvjoepiisx/Build/Products/Development-iphoneos/Wunderlist.app

info: [debug] Creating new appium session 63dfcc4f-fc6a-48d0-8e0b-e8d46a4a6b39

info: [debug] Appium session started with sessionId 63dfcc4f-fc6a-48d0-8e0b-e8d46a4a6b39

info: [debug] Responding to client with success: {“status”:0,”value”:{“ELEMENT”:”60″},”sessionId”:”63dfcc4f-fc6a-48d0-8e0b-e8d46a4a6b39″}

info: data-blogger-escaped-comment—data-blogger-escaped-comment—data-blogger-escaped-comment—data-blogger-escaped-comment—data-blogger-escaped-comment—data-blogger-escaped-comment—data-blogger-escaped-comment—

info: –> POST /wd/hub/session/63dfcc4f-fc6a-48d0-8e0b-e8d46a4a6b39/element/60/click {}

Desired Capabilities


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

http://appium.io/slate/en/master/?java#appium-server-capabilities

Android Capabilities

iOS Capabilities

Appium Server


Appium is a server written in Node.js

It can be built and installed from source or installed directly from NPM.

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.

                     Appium webserver works quite similar to selenium server which recives http requests from selenium client libraries through JSON and then it handles those requests in different ways depending upon the platforms your are looking at. Appium has its own mechanism for iOS and Android.

http://www.selenese.in/appium-architecture/

5. Appium Desktop Client 

https://github.com/appium/appium-dot-exe ( Windows Client )

https://github.com/appium/appium-dot-app  ( Mac Client )

check setup – click on “Stethoscope – Doctor” button to confirm all is well and then only proceed further

iOS Settings

https://help.testobject.com/docs/guides/appium-osx-ios/


https://blogs.technet.microsoft.com/antino/2014/09/22/how-to-set-up-a-basic-working-appium-test-environment/


https://github.com/appium/appium-dot-app/issues/577

https://medium.com/@chenchaoyi/the-options-of-inspecting-ios-10-app-with-appium-1-6-534ba166b958#.mk1qr7msh

Application

App Path: The path to the iOS application (.app, .zip, or .ipa) you wish to test.


Choose Button: Used to choose the path to your application.


BundleID: The bundle ID for the application you wish Appium to use (e.g. com.yourCompany.yourApp).


Use Mobile Safari: This will make Appium start the Mobile Safari app instead of using a user-supplied application. BundleID or App Path should both be unchecked when this option is used.

Device Settings

Force Device: This will make Appium force the Simulator to iPhone or iPad mode.


Platform Version: Version of the mobile platform.


Force Orientation: Force the orientation of the Simulator.


UDID: This is the UDID for the mobile device on which you want to run Appium. If this box is checked, Appium will use the attached iOS device. If this field is checked, bundle ID must be supplied and app path should be unchecked.


Show Simulator Log: If checked, the iOS simulator log will be written to the console.

General Settings

Logging

Log to File – check this box to log output to a file

Use Colors

Show Timestamps

Use Local Timezone

Android Setting

https://help.testobject.com/docs/guides/appium-osx-android/

Make sure to choose correct platform version

6. API ( Ruby )


IMHO Appium team need to improve a lot on documentation , compared to Selenium Java API documentation.


For now you can refer to below places to find out methods


1>  https://github.com/appium/ruby_lib/blob/master/docs/docs.md


2>  http://selenium.googlecode.com/git/docs/api/rb/index.html


3>  https://github.com/appium/ruby_lib/tree/master/docs

4>  http://www.rubydoc.info/github/appium/ruby_lib/Appium

 

7. SCM , Cloud CI


1>    http://www.projecthut.com/version-control-systems-compared/

2>   http://www.rightscale.com/blog/cloud-management-best-practices/continuous-integration-and-delivery-cloud-how-rightscale-does-it

8.   Efficient Ways Of Bugs Tracking & TC Management – My Views


1.  Human being is lazy by nature but QA engineer can’t & shouldn’t be 🙂 So just go ahead and write down user stories in SCM tool itself and get it reviewed with Development and Product Owner.


2. Keep revisiting / updating / adding / editing user stories based on bugs found during testing and by real users.


3. Map these user stories to automation scripts ( 1: 1 mapping to make sure no regression bugs are missed to production )

A BDD Lesson From My Past ( https://twitter.com/tonybruce77?lang=en

9.   Appium Project Bugs Reporting

In case you find any bug , just don’t complain in https://discuss.appium.io but file it under https://github.com/appium/appium/issues

 

10. Useful Tools: ( TBD )

1>  irb – http://www.tutorialspoint.com/ruby/interactive_ruby.htm 


2> http://rubular.com/ – Ruby Regular Expression Editor

11. Useful Links: ( TBR )

https://www.youtube.com/watch?v=ySglJIrDVMQ ( Appium v.1.6.0 – How to setup iOS Automation with XCUnitTest WebDriverAgentRunner )

Setup Appium on Mac OS to run automated tests from Java Classes on Android & iOS

https://github.com/SrinivasanTarget/awesome-appium ( A curated list of delightful Appium resources. )

http://shashikantjagtap.net/dockerising-appium-talk-at-appium-london-meetup/  ( Dockerising Appium

https://testobject.com/blog/2016/01/how-to-test-ios-apps-with-appium-on-os-x.html  ( How to Test iOS Apps with Appium on OS X – TestObject )


Appium iOS Provisioning Profilehttp://stackoverflow.com/questions/25733751/appium-provisioning-profile )

http://dentedghost.blogspot.de/2015/06/appium-testers-perspective-for-ios.html


https://discuss.appium.io/t/appium-developer-certificate-issues/2765/16


http://appium.readthedocs.io/en/stable/en/appium-setup/real-devices/


https://discuss.appium.io/t/appium-ios-app-testing/105/6  ( Refer to JessicaSachs answer )

http://mobiletest.engineer/ – Lots of useful info about Mobile Testing 

Get Involved – http://appium.io/get-involved.html

http://sauceio.com/index.php/tag/appium-bootcamp/ – BOOT CAMP

This section describes setup for Appium Ruby version.

Follow below blog from Dave Haeffner.

 

http://sauceio.com/index.php/2014/07/appium-bootcamp-get-started-with-appium-testing-chapter-1/?utm_source=blog&utm_medium=blog&utm_campaign=appium_bootcamp_ch_1_getting_started

and chapter 2 ( link in above blog )

http://appium.io/slate/en/tutorial/android.html?ruby#getting-started-with-appium

1. http://www.selenese.in/souce-lab-appium-blog/

2.  http://sauceio.com/index.php/2013/07/guest-post-mobile-testing-the-google-way-with-appium-sauce-labs/

3. http://sauceio.wordpress.com/tag/matthew-edwards/

http://www.atlantbh.com/appium-setting-up-mobile-automation-infrastructure-and-ci/ ( Appium , Real Devices , Jenkins , Appium + iOS + Jenkins , Appium + Android + Jenkins )

https://nishantverma.gitbooks.io/appium-for-android/content/index.html ( Appium for Android – online book )

https://www.utest.com/courses/how-to-set-up-your-first-android-automation-project-with-appium ( How to setup Your First Android Automation Project with Appium – utest course )

http://megettingerror.blogspot.com/2015/01/java-code-to-start-appium-server-on-mac.html – start and stop appium server

http://blog.rightqa.com/2015/08/start-stop-appium-server.html

http://stackoverflow.com/questions/6356340/killing-a-process-using-java kill a service / process

https://github.com/Genium-Framework/Appium-Support

https://www.linkedin.com/pulse/startstop-appium-server-programmatically-using-java-hassan-radi


https://discuss.appium.io/t/launching-and-stopping-appium-server-programmtically/700/4


https://discuss.appium.io/t/support-for-automating-multiple-devices-simultaneously/230 – multiple devices


https://github.com/saikrishna321/AppiumAndroidParallelExecution – parallel


https://github.com/saikrishna321/AppiumTestDistribution – parallel 


https://github.com/saikrishna321/PageObjectPatternAppium

http://qaautomationworld.blogspot.in/2014/11/appium-remote-execution-grid-execution.html

https://github.com/saikrishna321/AppiumTestDistribution/issues/7

http://blog.rightqa.com/2015/07/an-introduction-to-appium-architecture.html ( An Introduction to Appium Architecture )

https://www.built.io/blog/2015/03/start-automating-native-ios-testing-with-appium-using-node-js/ ( Start Automating Native iOS testing with Appium using Node.js )

https://help.testobject.com/docs/guides/appium-osx-ios/  ( Appium Teting on Physical iOS devices )

https://help.testobject.com/docs/guides/appium-osx-android/ ( Appium Testing on Physical Android Devices )

http://blog.wedoqa.com/2015/10/setting-up-appium-on-mac-os-x-for-ios-virtual-devices-to-test-your-application/  ( Setting Appium on Mac OS )


https://aaronpresley.com/building-ios-app-use-appium-gui/ (  
Building iOS App simulator only for Use in Appium GUI )

https://wiki.saucelabs.com/display/DOCS/Instant+Appium+Python+iOS+Real+Device+Tests#InstantAppiumPythoniOSRealDeviceTests-BuildingYouriOSAppforRealDeviceTesting ( Building iOS App for Real Device Testing )

http://james-willett.com/category/appium/  ( James Willett – Technical Testing )

Appium + iOS Real device issues ??

iOS UIAutomation to XCUITest Migrationhttps://github.com/appium/appium/blob/master/docs/en/advanced-concepts/migrating-to-xcuitest.md )

Android UIAutomator to UIAutomator 2https://github.com/appium/appium-uiautomator2-server/wiki )

12.  Elements Locator Strategy

Prerequisites

http://railsapps.github.io/installrubyonrails-mac.html  ( Install RMV , Ruby ) 

https://discuss.appium.io/t/difference-between-arc-and-irb/1426  ( arc vs irb commands )

Finding Android appActivity and appPackage with help of APK info app

>>>  Method 1: ( Appium Ruby Console ) <<<

https://saucelabs.com/resources/articles/appium-bootcamp-chapter-1 

( download ebook and refer to below chapters )

https://saucelabs.com/blog/appium-bootcamp-chapter-2-the-console ( appium.txt )

https://saucelabs.com/blog/appium-bootcamp-chapter-3-interrogating-your-app   Interrogating your app

https://github.com/appium/ruby_console

https://github.com/appium/ruby_lib/blob/master/docs/docs.md
https://blog.hiptest.net/2015/12/18/mobile-test-automation-with-appium-and-hiptest/

For Android

Appium.txt

[caps]

platformName = “Android”

deviceName = “dummy device name”

app = “FULL_PATH_IS_MUST/com.flipkart.android.apk”

(?? not sure why full path need to be given, even when both appium.txt and .apk are in same directory )

For iOS

instruments -s devices

Appium.txt ( Simulator )

[caps]
automationName = “XCUITest”
#comment 1
platformName = “iOS”
app = “/Users/vikram-anna/Library/Developer/…./XCodeGeneratedTestApplication.app”
#comment 2
deviceName = “iPhone SE”
platformVersion = “10.2”

Appium.txt ( Real Device )

[caps]

>>> Method 2: ( irb ) <<<

http://leanagiletesting.blogspot.in/2013/10/appium-on-windows-android-automation.html
https://hub.docker.com/r/isonic1/appium-and-emulator/

Goto Terminal in mac , 

in first tab start appium server and 

in second tab execute below steps in irb session  

2.2.1 :001 &gt; require ‘appium_lib’

2.2.1 :002 &gt; caps = {

caps: {

platformName: “iOS”,

deviceName: “Vikram’s Automation iPhone”,

udid:’dc84c00dc6807d13d0997ee802e7faa4a26f65ba’,

app: ‘/Users/vikram-anna/Library/Developer/Xcode/DerivedData/wunderlist-ddifxljcmzpfdfgvqrmvjoepiisx/Build/Products/Development-iphoneos/Wunderlist.app’,

newCommandTimeout: ‘9999’

},

appium_lib: {

server_url: ‘http://127.0.0.1:4723/wd/hub&#8217;,

wait: 300

}

}

2.2.1 :015 &gt; Appium::Driver.new(caps).start_driver

2.2.1 :016 &gt; Appium.promote_appium_methods Object

…then start using methods as below

page , page_class , @driver.find_element(:name , ‘Sign in’).methods

Helpful Links

https://github.com/appium/ruby_lib/blob/master/docs/docs.md 


https://github.com/appium/ruby_lib/blob/master/docs/android_docs.md

https://github.com/appium/ruby_lib/blob/master/docs/ios_docs.md

 

Method 3:  ( Others ) 

https://medium.com/@chenchaoyi/the-options-of-inspecting-ios-10-app-with-appium-1-6-534ba166b958#.ni3nhz70t  ( 3 option are mentioned )

iOS App Accessibility Inspector

https://developer.apple.com/library/ios/technotes/TestingAccessibilityOfiOSApps/TestAccessibilityiniOSSimulatorwithAccessibilityInspector/TestAccessibilityiniOSSimulatorwithAccessibilityInspector.html

http://executeautomation.com/blog/page-object-model-with-appium/ – Page Object Model With Appium

https://www.youtube.com/embed/wjvAh4yjwtI?feature=oembed – The Mobile JSON Wire Protocol


http://www.testingdiaries.com/appium-android-tutorial/ ( Appium Android Configuration with Eclipse )


http://www.testingdiaries.com/appium-ios-setup-native-apps/ ( Appium iOS Setup )


http://www.testingdiaries.com/mobile-performance-testing-record-script-jmeter/ ( Mobile Performance Testing )


http://www.tabaolan.com/MobileTest/mobile-testing-create-first-appium-webdriver-android-script-in-java/ ( Create First Appium WebDriver Android Script in Java )

https://saucelabs.com/resources/articles/appium-bootcamp-chapter-8 ( Finding Information On Your Own )


https://seleniumframework.wordpress.com/category/appium/


https://seleniumframework.wordpress.com/2015/10/15/mobile-continuous-integration/ ( Mobile CI )

Testing iOS App with Appium : Setup Video ( TestObject )


Testing Android App with Appium : Setup Video ( TestObject )

Accessibility Inspector YouTube   https://www.youtube.com/watch?v=4BgkVp0v3BM

Other Info ( TBR )

http://www.tutorialspoint.com/ruby/interactive_ruby.htm 

http://executeautomation.com/blog/locating-elements-in-appium-part-a/ – Locating Elements In Appium

13.  Appium + Selenium Grid / Grid Setup


http://blog.zymr.com/configuring-appium-node-servers-with-selenium-grid  ( Configuring Appium Node Servers with Selenium Grid )

14.  Continuous Integration

https://help.testobject.com/docs/tools/appium/continuous-integration/jenkins-gradle/ ( Running Appium tests through Jenkins using Gradle )

https://leanpub.com/ci-mobile-app 

https://testobject.com/blog/2016/06/testobject-appium-setup.html  ( Appium Setup with TestObject )


https://help.testobject.com/docs/tools/appium/setups/ ( Setting up Your Tests )