Use coded UI tests to test Windows store apps

Source: Internet
Author: User

Since the advent of Win8, the Windows Store has immediately become the stage for developers to show, and this short few years the number of applications can be tens of thousands, it is inevitable that the mixed situation. We all know that Visual Studio is the most popular integrated development environment for Windows Platform applications today. vs is a basic complete set of development tools that includes most of the tools needed throughout the software lifecycle, such as UML tools, code control tools, integrated development environment (IDE), and more. The target code is written for all platforms supported by Microsoft, and we can also use it to develop WIN8 applications. Visual Studio, on the other hand, can also be used for software testing, and its own templates are more convenient in Visual Studio Ultimate The new Win application UI test in 2013 will help us to test the WIN8 application more intuitively, so that we can easily detect bugs in the WIN8 application.

To introduce the basics of UI testing, the automated testing of the application through the application's user interface (UI) is calledcoded UI test (CUIT). These tests include functional testing of the UI controls. They enable you to verify that the entire application, including its user interface, is functioning properly. coded UI tests are especially useful for situations where validation or other logic exists in the user interface, such as in a Web page. They are also often used to automate existing manual tests. As shown, a typical development experience might be a scenario where you initially need to build your own application (F5) and verify that everything is working correctly by clicking the UI control.You may decide to create a coded test so that you do not need to continue to test the application manually.Depending on the specific functionality that you test in your application, you can write code for any functional test or for integration tests that might or might not include UI-level testing.If you only want to access certain business logic directly, you can write unit test code. However, in specific cases, it would be useful to include tests for various UI controls in your application. coded UI tests can automate the initial (F5) scenario to verify that code churn does not affect the functionality of your application.

I'll show you how to use coded UI tests to test Windows store apps in more detail:

(1) Create a new coded UI test project for Windows store apps (file → new → project → store app →windows application → Coded UI test (Windows)

(2) Choose to edit the UI map using the Crosshair tool

(3) Use the Crosshair tool in the coded UI Test Builder to select the app tile, right-click AutomationId, and select copy value to clipboard. Use the values in the Clipboard later to write an action to launch the app that you can test.

(4) in a running Windows store app, use the Crosshair tool to select a button control and a text box control. After you add each control, select the add control to UI control map button in the Coded UI Test Builder toolbar

(5) Select the Generate Code button in the Coded UI Test Builder toolbar and choose Build

To create code for changes made to the UI control diagram.

(6) Use the Crosshair tool to select the text box control and select the Displaytest property

(7) Add an assertion that will be used in the test to verify that the value is correct. Add and generate code for assertions.

(8) In Solution Explorer, open the UIMap.Designer.cs file to view the code that was added for the assertion method and control.

(9) In Solution Explorer, open CodedUITest1.cs. Add code to the CodeUTTestMethod1 method for the action required to run the test with a control that has been added UIMap:

(10) Run the test to

Experimental Analysis:

For Win8 a calculator application we perform the following tests

    1. Test Cases and Results:

Table test Case

     4

valign= " Top "width=" ">

Test number

Input

Expected output

Actual output

Whether to pass the test

1

2x3=

6

6

Is

;" >    2

style= "font-size:18px;" >   2√

1.414213562373

1.414213562373

Span style= "FONT-SIZE:18PX;" >     is

;" >    3

style= "font-size:18px;" >   4√

   " (" "

    no

;" >    4

style= "FONT-SIZE:18PX;" >   3 1/x

style= "font-size:18px;" >0.333333333333

0.333333333333

     is

;" >    5

style= "FONT-SIZE:18PX;" >   5 1/x

style= "FONT-SIZE:18PX;" >    0.2

     5

;" >    6

style= "font-size:18px;" >   8÷0=

style= "FONT-SIZE:18PX;" > (show exception information)

  positive Infinity

    is

;" >    7

style= "font-size:18px;" >   0 1/x

style= "FONT-SIZE:18PX;" >  (show exception information)

     0

;" >    8

style= "font-size:18px;" >   -3÷6=

   " (

    Yes

    9

36÷5x=

    51.84

     no

10

3-5x6=

-27

-12

Whether

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

(9)

       

(10)

2. Test the problem report

Table 2--Problem Summary

Question number

Use Case number

Problem description

Problem level

1

3

Open Square error (total square number cannot be opened)

3

2

5

Countdown Error (2, 4, 5, 8 cannot fall)

3

3

7

Error except 0

1

4

9

User illegal input

4

5

10

Operator Precedence Error

2

(5) Result: (Test pass and failed, other similar, no longer one by one list)



 

Use coded UI tests to test Windows store apps

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.