test automation: coded ui test - qa testing tools · test automation: coded ui test ....

43
Jan 25 th 2013 Test Automation: Coded UI Test

Upload: others

Post on 30-Sep-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Jan 25th 2013

Test Automation: Coded UI Test

Page 2: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 3: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 4: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Automated Testing

• Ensures you don’t miss out on running a test

• Can actually enforce and drive clean design decisions

• Have training value

Page 5: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Coded UI Test • Automated tests that drive your application through its user

interface (UI) are also known as coded UI tests (CUITs).

• These tests include functional testing of the UI controls. They

let you verify that the whole application, including its user

interface, is functioning correctly.

• Coded UI Tests are particularly useful where there is

validation or other logic in the user interface, for example in a

web page. They are also frequently used to automate an

existing manual test.

Page 6: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Coding Process with Coded UI Test • Test Cases

• Recording the actions

• Coding with testing strategies

• Auto-compile and run

• If tests fail

• Fault in test script-> make appropriate modifications

• Bug in the application -> report (PF OOTB)

• If tests pass -> move ahead

They are fun and challenging to write

One has to carefully think of design for reusability and coverage

Page 7: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Recording the actions

Coded UI Test Builder

Start recording

Add assertion Show recorded steps

Generate code

The Coded UI Test builder enables

you to record actions and add them

into your existing Coded UI Test

Page 8: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Test Window

• Test View window

• Test List Editor

Understanding the tests

Page 9: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Identify Portal Framework Defects

• Bugs can be identified by Coded UI Test

Habanero Portal Framework Out Of The Box

Page 10: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Identify Portal Framework Defects

• Bugs cannot be identified by Coded UI Test

Habanero PF Habanero OOTB

Page 11: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 12: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

UI Map Class • The real work takes place

• An assortment of supporting classes are generated

• Class diagram helps you to understand the relationships and the classes

involved.

Page 13: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Generic Library

• Using the auto-generated code in designer.cs Class

is very inefficient

• Construct an efficient, reusable, beautiful libraries

Page 14: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Even More Generic

Page 15: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Class Diagram

• Document Library

• List

• Calendar

• Page

• Asset

Page 16: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 17: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

The Automated Test Framework

Page 18: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Program Pattern

Page 19: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 20: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Framework function

https://h.habaneros.com/teamsites/QA/List

s/Framework%20Functions/AllItems.aspx

or visit QA site:

• These framework functions will be

documented in our Habanero QA site

Page 21: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 22: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Demo

• ContentPF

• Test Cases: 1. Add content to a page

2. Edit the content of a page

3. Apply a markup style to content on a page

4. Edit the HTML of the content on a page

• ListInheritancePF

• Test Cases: 1. Break inheritance on a list

2. Break inheritance on a single list item

• ListWorkflowPF

• Test Cases: 1. Define a workflow for a list

2. Perform workflow on a list item

• PagePF

• Test Cases: 1. Create new page

2. Modify page properties

3. Check in/ Check out a page

4. Delete a page

5. Email a link to a page

I will run the following tests if time permits:

Page 23: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 24: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Reliability

• Controls & Actions

• Ensure the program find the correct controls

• Ensure the actions get executed

• Unstable Tests

• Some tests may wander between Pass and Fail

• Use Meaningful name

• helps identify the purpose of the method

• Limit each recorded method to fewer than 10 actions

• Makes it easier to replace a method if the environment changes

• Use the data from app.config file instead of hardcoding the data

• Increase the reliability of making an assertion

Page 25: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 26: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Usability & Reusability

• Coded UI Tests are completely reusable

• Need to setup a continuous integration server

• Create libraries as the codebase

• Customize Search Properties

• Overwrite Search properties with parameters

• Customize Complete Functions

• Atomic Tests

• Tests are not depend on other tests

• Reusable modules (The BaseTest Class)

• Common test functions

Page 27: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Customized Search Properties

Page 28: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Customized Search Properties

Page 29: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Customized Functions

Page 30: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Customized Methods

Page 31: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 32: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Efficiency

• Web Page Navigation

Page 33: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Efficiency

• Eliminate Delay

Page 34: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Efficiency

• Add Delay

Sometimes, the control runs faster than the web browser

Page 35: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

1.Introduction

2.Internal Class Structure (Generic

Structure)

3.Program architecture

4.Framework function

5.Demo

6.Reliability

7.Usability & Reusability

8.Efficiency

9.Build Process in the Future

Page 36: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Test Cases

Coded UI Test

TFS

MTM

Client Projects

Build

Process

Page 37: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Test Cases

Build Process

At this point, we have created numerous Test Cases.

We can execute a Coded UI Test Case simply by taking the compiled assembly

and executing it with Visual Studio or MSTest from the command line,

which require us to sit there and do nothing while the test executes

Another way:

Associate Coded UI Tests and Test Cases

Run the tests from Microsoft Test Manager

Page 38: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

MSTest

Page 39: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Associating Coded UI Tests and Test Cases (TFS)

Page 40: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Microsoft Test Manager

Page 41: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Next Step ( a typical way)

• Set Up Team Build

• With correct build definition and configuration

• So that the automated test can be found in the share location for the

build definition and then it can be run from MTM

• Create Test Settings and Virtual (Physical) Environment

• We cannot run Coded UI Tests using MTM without an environment

• Create an environment that contains the roles in the test settings

and then use this environment in the test plan

Page 42: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Sometimes, things don’t work the way you want it to be.

Page 43: Test Automation: Coded UI Test - QA Testing Tools · Test Automation: Coded UI Test . 1.Introduction 2.Internal Class Structure (Generic Structure) 3.Program architecture 4.Framework

Thank you

If you have any comments on the coded UI test,

feel free to let me know