Appium on IOS automated testing

Source: Internet
Author: User
Tags appium

There are many automated test tools for mobile platforms, which have previously studied the native Automation testing framework for Android and Apple, and have been introduced by some colleagues, seemingly appium is a good tool.

Want to record the results of the study, but also a dry article

Also saw some videos on the internet, personally think that the characteristics of this automated test is


1. Multi-programming language support

Compared to the traditional iOS uiautomation can only support the JS language, Appium played a role in translation, it is actually a CS architecture, server and iOS simulator or real computer direct communication, the client and the server with the HTTP protocol to interact with, So it doesn't really matter what language the client uses. Here is a practical example of Python programming.


2. Remote test support

As stated above, the client and server communicate with the HTTP protocol, that is, the client can be on the same machine as the server or a different machine.


3. Better recording function

Appium provides a great recording tool that allows the programmer to accurately record steps in a step-by-step process.


4. Single-Step commissioning

Programmers can use advanced scripting languages, such as Python, to step through a test program, such as a command that corresponds to a UI action


How to use Appium, based on the May 2014 release of Appium 1.0来 said, about this,

You have to have xcode on the basis of automated testing, if not, please first tutorial


A. If the simulator test

1. Select the location of the app installation package

2. Choose the desired simulator platform, iOS version, and then click on Launch.



3. Launch will find nothing after all, in fact Appium has run, please note that there is no error in the running window

4. Below is the test case, click on a blue bottom, the white I button

5. inspector window will appear after a period of time



6. Here is an example, for example, I want a button,

6.1 First now the left tree window inside find a button position, a bit like Firebug find the page control

6.2 Then select the action you want in the Action box below, tap is tap, and you will find that this button is really clicked (this is a straightforward example of one-step debugging)



7. How to turn recording into a script

7.1 First to click the Record button in the Inspector window

7.2 Choose the programming language you need

7.3 Continue to repeat the UI actions you need to do

7.4 And finally the code is copied out.



8. How to re-record the test

8.1 Turn off the inspector,

8.2 The code needs to be slightly modified, Python's code is actually a syntax error, here is an example, the comparison is good (of course, the necessary Python library must be installed)

From selenium.webdriver.firefox.webdriver import webdriverfrom selenium.webdriver.common.action_chains Import Actionchainsimport timeimport Osimport seleniumsuccess = truedesired_caps = {}desired_caps[' browserName '] = ' IOS ' desired_caps[' Platform ' = ' Mac ' desired_caps[' version '] = ' 6.1 ' desired_caps[' device '] = ' iPad ' desired_caps[' app ' = Os.path.abspath ('/users/marshall/library/developer/xcode/deriveddata/ Testautomation-empzzpwyyxctxidnwdsrtlssueqi/build/products/debug-iphonesimulator/testautomation.app ') WD = Selenium.webdriver.Remote (' Http://0.0.0.0:4723/wd/hub ', desired_caps) wd.implicitly_wait def is_alert_present ( WD): Try:wd.switch_to_alert (). Textreturn Trueexcept:return Falsetry:wd.find_element_by_name ("First"). Click () Wd.find_element_by_name ("Second"). Click () finally:wd.quit () If not success:raise Exception ("Test failed.")

8.3 Run code to view test results


B. If the test is a real machine

Real machine test actually encountered some problems, I probably say my steps

1. Configuring the application's Bundleid and device Udid



Bundleid don't know how to look, please use itools

Udid don't know how to find it. Please use itunes or itools

The app must be signed by your own developer account


2. Launch Appium


3. Click on the Inspector button and the app will appear on the ipad, but it will flash back in a few clicks (I've tried several applications with this problem), and I've reported a bug to Appium to see if there's a response.

If someone successfully uses inspector on a real machine, please leave a message and share it.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.