Using instrument (a) in iOS development Automation

Source: Internet
Author: User

Opening

Open Cnblog found himself for several years, not in the above update blog, these days in the collation of some information, found themselves using the instrument process of some of the documents and materials, data collation time should be last year, However, the use of instrument in iOS development is very helpful, I use the process has been using the management of multi-memory, instrument for me in the application of the problem solving a great help, written as a blog to record.

==============================================================

Automation

Knowledge of automated testing

    • Automated testing:

Automated testing is the process of translating a man-driven test behavior into a machine execution. Typically, after a test case has been designed and reviewed, the tester performs the test step-by-stage according to the procedures described in the test case to obtain a comparison between the actual result and the desired result. In this process, in order to save manpower, time or hardware resources, improve testing efficiency, the introduction of the concept of automated testing (from Baidu Encyclopedia).

    • Automation:

Automation is a framework for automating test execution on iphone device and iphone simulator, released with iOS 4.0 system

    • UIAutomation Test Requirements:

Test the app source code, import the required script files, learn about JavaScript

    • Instrument Automation use
    • To import a test script:
    1. Open tested App Project
    2. ? +i Open Instrument
    3. Select Automation Template->profile
    4. ? +r Stop Profile
    5. On the left scripts select Add->import ...,
    6. Select the written test script (you wrote a script showuiaelenmenttree.js) scripts will have a script list
    7. Script contents can be seen in script list to the right
    8. ? +r performing Script tests
    9. You can see the script test log
    • To record a test script:

Provides a record user action to generate a test script when operating on an interface, but automatically generates a test script without an assertion action

1: Open tested App Project

2:?+i Open Instrument

3: Choose Automation Template->profile

4:?+r Stop Profile

5: On the left scripts select Add->create ... If you see a new script file, you see 3 action buttons below the script code

6: Click the Red Record button, will launch the app, you are on the device or simulator operation will generate action code click the Square Stop Record button recording complete, after? +r stop

7: You need to replay the recording script again can click the Triangle button, or directly? +r perform test playback

      1. To write a test script:

By importing test scripts and recording scripts, you can familiarize yourself with some basic APIs

Next write a test script

1: Open tested App Project

2:?+i Open Instrument

3: Choose Automation Template->profile

4:?+r Stop Profile

5: On the left scripts select Add->create ... You will see a new script file generation script editable area for scripting such as 4 regions, where test cases are written in this area

6: Test Case writing

Code Demo: interface input TextField input length

var target = Uiatarget.localtarget ();

var app = Target.frontmostapp ();

var window = App.mainwindow ();

var textfields = Window.textfields ();

Check Number of Text field (s)

if (textfields.length!=1)

{

Uialogger.logfail ("Fail:inavlid Number of Text field (s)");

}

Else

{

Uialogger.logpass ("Pass:correct Number of Text field (s)");

}

Note

1: In the use of equipment for automated testing it is important to note that in the release configuration choose to use developer profile (not Ad-hoc distrubution profile). The default release profiling has been completed.

2: Documentation

UIAutomation JavaScript API Reference Documentation:

http://developer.apple.com/library/ios/#documentation/developertools/reference/uiautomationref/_index.html

Using instrument (a) in iOS development Automation

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.