IOS uiautomation Test

Source: Internet
Author: User
Reprint source Taobao QA Team, original address: http://qa.taobao.com /? P = 13737

 

Wireless Clients have developed rapidly, especially for client applications of Android and iOS wireless operating systems. The corresponding test tools have also emerged, here we will introduce some automated testing tools for iPhone apps.

First, we divide these testing frameworks into three categories: interface testing tools, injection UI testing tools, and directory-based UI testing tools.

I. Interface testing tools, mainly based on the unit test framework provided by the iPhone SDK, to test the interface function of the Code.

Most of these tools use the test unit provided by the SDK and Google-toolbox-for-Mac. Google's GTM tool is encapsulated on test unit, which allows you to easily and quickly write test scripts and provide complete test logs and reports, and provides some simple UI testing functions.

Detailed documentation can be referred here: http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting

2. The injection UI testing tool can test the UI function of the tested application. You need to add some necessary testing code to the source code. The advantage is that it can simulate user operations, test the functions of the tested application, and cover a wide range of application functions. The disadvantage is that necessary test code is inserted in the source code, which needs to be removed during the release of these applications, introducing the risk of inconsistency between the tested and released applications.

Uispec provides the preparation and recovery functions, uiquery functions, and complete verification functions before the use case is run. However, the use of this tool is complex and script writing is also cumbersome, although you can query the UI, you cannot conveniently, clearly, and intuitively view the properties of the application control.

Detailed documentation can be referred here: http://code.google.com/p/uispec/wiki/Documentation

Bromine: the script is easy to write. It fully simulates touch events for control operations. However, the control is located by re-painting the control and inserting the information needed for positioning, the description string of xpath is also slightly complex, and the verification function is relatively weak.

Detailed documentation can be referred here: http://code.google.com/p/bromine/

3. The recording UI testing tool mainly tests the functions of the tested application by recording users' operation behaviors and playback, these tools are relatively weak in testing UI functions.

Commonly used tools include instrument and fonemonke.

Instrument is a tool provided by IOS that is mainly used to analyze application performance and user behavior. It can be used to complete simple UI testing of the tested application.

Fonemonke is an open-source and free recording/playback tool provided abroad. Website: http://www.gorillalogic.com/fonemonkey

The above are some automated testing tools for iPhone apps. If you are interested, you can understand them!

Added the built-in functions of ios sdk: Script Programming + control tag + intrument Tool

Http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html

The main thing is to tag all your UI controls in interface builder with names, by setting the Accessability label to a unique value for the view.

Once these are all set and you 've rebuilt your application for debug, you need to write a Javascript file that runs your application and tests to make sure that everything is running as expected. here's a sample file, followed by some commentary.

var view = UIATarget.localTarget().frontMostApp().mainWindow().elements()[2];var textfields = view.textFields();if (textfields.length != 2) {    UIALogger.logFail("Wrong number of text fields");} else {    UIALogger.logPass("Right number of text fields");}var passwordfields = view.secureTextFields();if (passwordfields.length != 1) {    UIALogger.logFail("Wrong number of password fields");} else {    UIALogger.logPass("Right number of password fields");}textfields["username"].setValue("tturner");passwordfields[0].setValue("tod");view.buttons()["logon"].tap();var errorVal = view.staticTexts()["error"].value();if (errorVal != "Invalid User Name or Password") {    UIALogger.logFail("Did Not Get Invalid Username Error: " + errorVal);} else {    UIALogger.logPass("Username Error Detected");}

 

Related Article

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.