coded ui - lesson 6 - manual coding

14
Automatic Testing using the Coded UI Framework Lesson 6 Manual Coding Omer Karpas

Upload: omer-karpas

Post on 17-Jul-2015

371 views

Category:

Software


7 download

TRANSCRIPT

Page 1: Coded ui - lesson 6 - manual coding

Automatic Testing using the Coded UI Framework

Lesson 6 – Manual Coding

Omer Karpas

Page 2: Coded ui - lesson 6 - manual coding

Project Entities There are 3 types of entities to our project :

Control Mapping.

Implementation.

Scenarios.

Page 3: Coded ui - lesson 6 - manual coding

Control Mapping The control mapping file contains all the AUD

controls.

Most of the controls are mapped in the controls file, but not all, because some can only be detected in run time.

Page 4: Coded ui - lesson 6 - manual coding

Control Mapping Each class in the file is a single control mapping, or

else, when using it, we will get an exception (error).

The file is like a family graph where each control has its direct childes mapped in its class.

All controls are children’s of the main program window class.

Page 5: Coded ui - lesson 6 - manual coding

Implementation The implementation file contains a single static class

that contains all the methods (Actions and Verifications) that we want to run on the AUT.

Examples:

Open application.

Click abc button.

Set xyz textbox to “123”.

Page 6: Coded ui - lesson 6 - manual coding

Scenarios (Test Cases) The Test Case file contains calls to methods from the

Implementation file, in a specific order to verify the requested functionality.

Example:

Open the application.

Click abc button.

Verify Label text is “123”.

Page 7: Coded ui - lesson 6 - manual coding

Creating the Project structure Right click on the Project and select “Add” -> “New

Folder”, and create 3 folders and change their names.

Page 8: Coded ui - lesson 6 - manual coding

Creating the Project structure Right click on the Implementation folder and select

“Add” -> “Class…”, set a name for it and press “Add”.

Page 9: Coded ui - lesson 6 - manual coding

Creating the Project structure Right click on the Controls folder and select “Add” ->

“Class…”, set a name for it and press “Add”.

Page 10: Coded ui - lesson 6 - manual coding

Creating the Project structure Add the following lines to both class files at the top of them – in the Using

area: using System; using System.Collections.Generic; using System.Drawing; using System.Text.RegularExpressions; using System.Windows.Input; using System.Diagnostics; using Microsoft.VisualStudio.TestTools.UITest.Extension; using Microsoft.VisualStudio.TestTools.UITesting; using Microsoft.VisualStudio.TestTools.UITesting.WinControls; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard; using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;

Page 11: Coded ui - lesson 6 - manual coding

Creating the Project structure Add the following lines to the Implementation class:

public Impelmentation()

{

}

ApplicationUnderTest app = ApplicationUnderTest.Launch(@"C:\Program Files (x86)\HBS26\HBS.exe");

Those lines are a default constructor and object of the ApplicationUnderTest class that lunches the exact shownpath.

Page 12: Coded ui - lesson 6 - manual coding
Page 13: Coded ui - lesson 6 - manual coding

exercises Create a new Coded UI Project.

Define the following abbreviations: KDT- AUT- VS- BB- GUI- VB- CUIT- TC-

Page 14: Coded ui - lesson 6 - manual coding

exercises Write the 4 types of areas of the automation project,

and explain each one of them in your own words.