IOS _ details iPhone application automation test case implementation

Source: Internet
Author: User

IPhone applicationsAutomationTestCase implementation is the content to be introduced in this article, mainly to implementIPhone applicationsAutomation inTest. The following is a basic study conducted by colleagues. After thatTest, Or yes. More features require time to study.

Setting method:

(1) install xcode and iPhone SDK on Mac, preferably the latest version.

(2) Open/developer/applications/instruments. app, select all for iOS in the template list, and then select the automation template.

(3) connect the iPhone to Mac, select the "choose target" drop-down menu on the main panel of instruments, select the connected iPhone, select the "choose target" option, and select the application to be tested.Program.

(4) Select "choose script…" on the left side of the instruments main panel ..." Drop-down menu and select a compiled JavaScript Command Script (Suffix:. js. If you need to modify it, click the "edit" button next to it)

(5) Click "record" to start automatic testing. The automatic test does not stop automatically after it starts. You need to manually click "stop" to stop it.

Examples of available command scripts:

 
  
  
  1. Uiatarget. localtarget (). frontmostapp (). mainwindow (). Buttons () [0]. Tap ();

Click the first button on your software interface.

Possible problem 1:

Unable to obtain task,

 
  
  
  1. The error message "target failed to run: Remote exception encountered: 'failed to get task for PID ### '" appears.

Cause:

Entitlements. plist is missing in the built application.

The solution is to add an entitlement. plist with "can be debugged:

(1) Open the project with xcode, and select the application to be tested from the "groups & Files" list on the left side of the main panel. Resources

(2) Select File, new file ..., Then, select the IOS code signing in the list on the left and select "entitlements". Then, click "Next" and click "finish.

(3) Open entitlements. plist with/developer/applications/utilities/property list editor. app, and select view, property list type, and iPhone entitlements plist.

(4) In the property list editor. in the main panel of the app, select iPhone entitlements, click "ADD child" in the toolbar, add the "can be debugged" option, tick the value, and save the settings.

(5) In xcode, select project, set active SDK, device, and then select project, set active build configuration, and debug.

(6) After completing the above steps, build the application and synchronize it to the iPhone. When you add entitlements. plist, if you cannot build the certificate or synchronize it to the iPhone, it is likely that the certificate and preset file are the cause. Ensure that the certificate and preset file are valid and imported correctly.

Software Version:

 
  
  
  1. Instruments 2.7 (3017)
  2. Xcode 3.2.5

Summary: DetailsIPhone applicationsAutomationTestThe implementation of the case is complete. I hope this article will help you!

[Edit recommendations]

    1. Nslocalizedstring is used in iPhone applications for internationalization
    2. Asihttprequest, an open-source HTTP packaging project for iPhone applications
    3. Highlights and solutions for problems in iPhone application development
    4. Model object archiving for iPhone application development
    5. IPhone application Address Book Contact development case
    6. How to obtain the hardware version and system information in iPhone applications

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.