Research on Windows Phone 8 test automation (leveraging coded UI)

Source: Internet
Author: User

Preface

Windows phone is a relatively new platform that currently has fewer applications and less functionality than iOS and Android for the same application. So what's the solution for automated testing on Windows Phone?

Currently on MSDN, Seetest is Microsoft's recommended test scenario.

You know Microsoft has integrated the automated test tool coded UI in VS, so coded UI can support the Windows Phone app in addition to testing windows, Web apps?


using the coded UI to do the win phone automation process


Using the coded UI is an automated test that can do Windows Phone, but the support is not very good, probably say the process

1. First need a real windows Phone or Windows Phone Simulator

(The Windows phone emulator requires a PC to support some hardware requirements, seemingly based on Hyper-V technology, and don't expect to be emulated in virtual machines (VSphere, XenServer), but VMware Workstation seems to be possible)


2. Need vs + update 2, when installed note to select the Windows Phone 8 SDK


3. After the installation, build a coded UI test project


4. Writing the test code

I wrote a very small Windows Phone program, the UI of this program is XAML-based.

Let's talk about a few steps.


A. Launching the app

This is a very clever step, unlike Android and iOS launcher apps, which need to be applied AutomationId and then start up.

After opening the coded UI's recording interface and moving the mouse to the tested Windows Phone app, the keyboard uses the shortcut key ctrl+shift+i to get the current control AutomationId

(Notice the window in the Blur)

Use the following code to open a specific app

String Myapp = "{f0915983-7002-4079-a128-81323efaa57a}:app:f0915983-7002-4079-a128-81323efaa57a_rkdnfethpsswy! App ";            Xamlwindow.launch (Myapp);

B. Identifying controls

The Coded UI doesn't support recording for Windows Phone apps, which is a bit of a headache, and the way I'm doing it right now.

B.1 follow <a. To start the app >, use the shortcut keys Ctrl+shift+i View the properties of the control.

B.2 adding a assertion to the control

After B.3 joins the assertion, the Coded UI will recognize the control, which can be seen in the edit interface of the Coded UI (note that if you just recognize the control without assertion, the control will not be recorded)


Then it's simple, select the control, then press the shortcut key CTRL + C, the control's code is copied down (for example, UIMap.UIWpappWindow.UIAEdit), the following depends on how to manipulate the

c. Manipulating Controls

At present, two methods are researched, one is click, the other is input

C.1 Click

Using the following code, the parentheses are examples of controls

Gesture.tap (UIMap.UIWpappWindow.UIPlusButton);

C.2 Input

Take a look at the code, the control. Text = "Assigned value"

UIMap.UIWpappWindow.UIBEdit.Text = "200";

Class Microsoft.VisualStudio.TestTools.UITesting.Gesture, there are other methods, you can carefully figure it out.


D. Inspection results

This is the same as the traditional operation of coded UI, that is, using assertion, there is not much to say


E. Other ideas

E.1 Currently the coded UI only supports the XAML-based win phone app, if you see the following, please don't fuss

Personally think that the current image recognition is the only way to expand the win phone automation test.



Summary

Using the coded UI for the automation of the win phone app is not very mature at the moment, it also lacks the support of iOS and Android's Open source community, which is actually embarrassing. Individuals still support the development of the win phone app and hope that it will become more powerful later, allowing testers to have more career opportunities in mobile app testing.





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.