Automatic Testing using the Coded UI Framework
Lesson 6 – Manual Coding
Omer Karpas
Project Entities
 There are 3 types of entities to our project :
 Control Mapping.
 Implementation.
 Scenarios.
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.
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.
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”.
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”.
Creating the Project structure
 Right click on the Project and select “Add” -> “New
Folder”, and create 3 folders and change their names.
Creating the Project structure
 Right click on the Implementation folder and select
“Add” -> “Class…”, set a name for it and press “Add”.
Creating the Project structure
 Right click on the Controls folder and select “Add” ->
“Class…”, set a name for it and press “Add”.
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;
Creating the Project structure
 Add the following lines to the Implementation class:
 public Impelmentation()
 {
 }
 ApplicationUnderTest app = ApplicationUnderTest.Launch(@"C:Program Files
(x86)HBS26HBS.exe");
 Those lines are a default constructor and object of the
ApplicationUnderTest class that lunches the exact shown
path.
exercises
 Create a new Coded UI Project.
 Define the following abbreviations:
 KDT-
 AUT-
 VS-
 BB-
 GUI-
 VB-
 CUIT-
 TC-
exercises
 Write the 4 types of areas of the automation project,
and explain each one of them in your own words.

Coded ui - lesson 6 - manual coding

  • 1.
    Automatic Testing usingthe Coded UI Framework Lesson 6 – Manual Coding Omer Karpas
  • 2.
    Project Entities  Thereare 3 types of entities to our project :  Control Mapping.  Implementation.  Scenarios.
  • 3.
    Control Mapping  Thecontrol 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.
  • 4.
    Control Mapping  Eachclass 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.
  • 5.
    Implementation  The implementationfile 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”.
  • 6.
    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”.
  • 7.
    Creating the Projectstructure  Right click on the Project and select “Add” -> “New Folder”, and create 3 folders and change their names.
  • 8.
    Creating the Projectstructure  Right click on the Implementation folder and select “Add” -> “Class…”, set a name for it and press “Add”.
  • 9.
    Creating the Projectstructure  Right click on the Controls folder and select “Add” -> “Class…”, set a name for it and press “Add”.
  • 10.
    Creating the Projectstructure  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;
  • 11.
    Creating the Projectstructure  Add the following lines to the Implementation class:  public Impelmentation()  {  }  ApplicationUnderTest app = ApplicationUnderTest.Launch(@"C:Program Files (x86)HBS26HBS.exe");  Those lines are a default constructor and object of the ApplicationUnderTest class that lunches the exact shown path.
  • 13.
    exercises  Create anew Coded UI Project.  Define the following abbreviations:  KDT-  AUT-  VS-  BB-  GUI-  VB-  CUIT-  TC-
  • 14.
    exercises  Write the4 types of areas of the automation project, and explain each one of them in your own words.