iOS uiautomation test

Source: Internet
Author: User
Tags documentation

[JavaScript]
View plain copy reproduced the source <a href= "http://qa.taobao.com/" >taobao QA Team</a>, source address: <a href= "http:// qa.taobao.com/' http://qa.taobao.com/?p=13737 ' ">http://qa.taobao.com/?p=13737</a>

Wireless clients are fast growing, especially for the Android and iOS two wireless operating system client applications, the corresponding testing tools have emerged, here mainly to introduce some of the iphone app automation testing tools.

First, we divide these test frameworks into three broad categories: interface test tools, injection UI test tools, and playback UI test tools.

Interface testing tools, mainly in the iphone SDK provided by the Unit Testing framework, the completion of the interface functional testing of the code.

This kind of tool uses a lot of the SDK itself to provide test unit, as well as Google's Google-toolbox-for-mac tools. Google's GTM tool is a layer of encapsulation on test unit that allows simple, fast completion of testing scripts, provides complete test logs and reports, and provides some simple UI testing capabilities.

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

Second, the Injection UI test tool, you can complete the application of the test UI function testing, you need to add some necessary test code in the source code. The advantage is that it can simulate the user's operation, test the related function of the application, and can cover the comparison of the whole application function. The disadvantage is that the necessary test code is inserted into the source code, and these applications need to be removed when they are released, introducing the risk of inconsistency between the application being tested and the release application.

Uispec, provides a use case to run before the preparation and operation of the recovery function, Uiquery function, as well as the more complete verification function, but the use of the tool is more complex, script writing is very cumbersome, although the UI can query, but not convenient, clear, intuitive view of the application control properties.

Detailed documentation can refer to here: http://code.google.com/p/uispec/wiki/Documentation

Bromine, the script is simple, the operation of the control, completely simulate touch event implementation, but the control's positioning by the control to repaint and insert the information needed to locate, XPath's description string is slightly more complex, the verification function is relatively weak.

Detailed documentation can refer to here: http://code.google.com/p/bromine/

Third, the playback of the UI test tool, mainly by recording the user's operation behavior, through playback to complete the test of the application of functional testing, such tools on the UI functional testing is relatively weak.

More commonly used are instrument, Fonemonke.

Instrument, a tool that iOS provides primarily for analyzing the performance and user behavior of applications, can be used to perform simple UI tests for applications being tested.

Fonemonke is an open source, free recording/playback tool available abroad. Website: http://www.gorillalogic.com/fonemonkey

The above is the understanding of some of the iphone app Automation testing tools, we are interested in understanding, welcome to communicate, learn.

Plus an iOS SDK feature: Scripting +control tag+intrument Tools

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 uni Que value for the view.




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

[JavaScript]  View plain copy Var view = uiatarget.localtarget (). Frontmostapp (). MainWindow (). elements () [2] ;   var textfields = view.textfields ();   if  (textfields.length != &NBSP;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.