Presentation is loading. Please wait.

Presentation is loading. Please wait.

Coded UI Testing Clive G Hermann

Similar presentations


Presentation on theme: "Coded UI Testing Clive G Hermann"— Presentation transcript:

1 Coded UI Testing Clive G Hermann
October, 2012 Automating Coded UI Testing using Microsoft Testing Tools in Visual Studio 2012 Clive G Hermann © GSAtrain

2 Introductions Name Title/Function Job Responsibility
Coded UI Testing October, 2012 Introductions Name Title/Function Job Responsibility Testing Experience C# Experience Expectations for the Course © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

3 Course Materials Lab Manual - Printed Course Notes - PowerPoint Slides
Coded UI Testing October, 2012 Course Materials Lab Manual - Printed Course Notes - PowerPoint Slides Virtual Machines for TFS and VS 2012 Links and Whitepapers (Favorites) © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

4 Course Contents Overview of Automated Code UI Testing
Coded UI Testing October, 2012 Course Contents Overview of Automated Code UI Testing Walkthrough Steps from Beginning-to-End Creating Manual Tests Creating a Coded UI Test Using Coded UI Test Builder Automating Coded UI Test Cases Notes: © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

5 Course Contents (Continued)
Coded UI Testing October, 2012 Course Contents (Continued) Data Driven Coded UI Tests Anatomy of Code UI Tests Introduction to Lifecycle Management Extending Coded UI Tests and Action Recordings Testing Large Applications with Multiple UI Maps © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

6 Course Contents (continued)
Coded UI Testing October, 2012 Course Contents (continued) Using HTML5 Controls in Coded UI Tests Visual Studio 2012 ALM Features Upgrading Coded UI Tests from Visual Studio 2010 Using WPF with Coded UI Tests Best Practices for Coded UI Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

7 Course Contents (optional)
Coded UI Testing October, 2012 Course Contents (optional) Using the Coded UI Test Logs Using SharePoint with Coded UI Tests ExcelCodedUIHelper © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

8 Overview of Automated Coded UI Testing
October, 2012 Module 1 Overview of Automated Coded UI Testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

9 Automated Code UI Testing
Coded UI Testing October, 2012 Automated Code UI Testing UI Testing Functional Testing Controls User Interface Whole Application The earlier we catch a “bug” or potential problem the less it costs! Image Manpower © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

10 Reality of Automated Testing
Coded UI Testing October, 2012 Reality of Automated Testing 70% of all Testing is manual © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

11 What is Coded UI Testing?
October, 2012 What is Coded UI Testing? Replacing a Manual User Interface Test with an Automated Test. To Allow: Replication Consistency Regression Testing For: Multiple Environments Multiple Versions © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

12 IT Has a Problem Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

13 Coded UI Testing October, 2012 Test Early and Often Catching defects as early as possible is the least expensive way to ensure software quality Kent Beck and Cynthia Andres wrote "Here is the dilemma in software development: defects are expensive, but eliminating defects is also expensive.” “However, most defects end up costing more than it would have cost to prevent them." © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

14 The Testing Trends Forwards
Coded UI Testing October, 2012 The Testing Trends Forwards Test-Driven Development Design the Test Then Write the Code © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

15 The Testing Trends: Backwards and Circular
Coded UI Testing October, 2012 The Testing Trends: Backwards and Circular Linking it all together Help-Desk Test Story Board Task Unit Programmer © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

16 The Ultimate Goal of Software Testing
Coded UI Testing October, 2012 The Ultimate Goal of Software Testing To find the bugs before your users do! UI Testing is END USER TESTING OR TOTAL SYSTEM TESTING OR INFRASTRUCTURE TESTING © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

17 Manual to Coded UI Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

18 Testers’ Multiple Roles
Coded UI Testing October, 2012 Testers’ Multiple Roles Guarantee SOFTWARE QUALITY Regression Test each Version or Build Test all Environments Provide Developers with all the information required: To REPRODUCE THE “BUG” Trace the steps to get the BUG Screen shots, IntelliTrace, Logs and Stack Traces NO-REPRO must be ELIMINATED © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

19 Tiers of Software Testing
Coded UI Testing October, 2012 Tiers of Software Testing Clear Separation of Functions Clear Definition of Communication and Collaboration TEAM of Software Quality © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

20 Walkthrough Steps from Beginning-to-End
Coded UI Testing October, 2012 Module 2 Walkthrough Steps from Beginning-to-End © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

21 Walkthrough Steps from Beginning-to-End
Coded UI Testing October, 2012 Walkthrough Steps from Beginning-to-End Lesson 1 Manual Testing Using Microsoft Test Manger to create and manage Test Plans Running Test Cases and Publishing Results Conducting Exploratory Testing Fast Forward for Manual Testing Lesson 2 Coded User Interface Testing Automated Functional Tests – Using CUIT Create a CUIT from Scratch Create a CUIT from action recording Making CUIT more Robust and Flexible © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

22 A Manual Testing Process
Coded UI Testing October, 2012 A Manual Testing Process Plan Design Test Track Verify Automate © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

23 Building an App For Manual Testing
Coded UI Testing October, 2012 Building an App For Manual Testing Demo of Simple Calculator © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

24 Automating the Calculator
Coded UI Testing October, 2012 Automating the Calculator Demo © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

25 Adding Data Demo Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

26 Introducing an Error Demo Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

27 Hands-On Lab Walkthrough Steps from Beginning-to-End
Coded UI Testing October, 2012 Hands-On Lab Walkthrough Steps from Beginning-to-End Examine the code to be tested Create a Coded UI Test the Coded UI Add a data file to drive the UI Tests Run all of the tests Create errors in the data file Examine failed tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

28 Module 3 Creating Manual Tests Coded UI Testing October, 2012
© GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

29 Visual Studio 2012 Supported Test Types
Coded UI Testing October, 2012 Visual Studio 2012 Supported Test Types © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

30 Microsoft Test Manager
Coded UI Testing October, 2012 Microsoft Test Manager Provides a single environment to author and manage Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

31 Testing Center Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

32 Generate Code for Coded UI Test
Coded UI Testing October, 2012 Generate Code for Coded UI Test © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

33 Quick Start Guide for Manual Testing using Microsoft Test Manager
Coded UI Testing October, 2012 Quick Start Guide for Manual Testing using Microsoft Test Manager us/library/dd aspx © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

34 Easily Reproducing Issues Through Manual Testing
Coded UI Testing October, 2012 Easily Reproducing Issues Through Manual Testing Introducing Managed Exploratory Testing The 5 Minute “elevator” Video Studio-2012-Premium-and-Ultimate- Overview/Visual-Studio-Ultimate Easily-reproducing-issues-through-manual- testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

35 Creating a Coded UI Test Using Coded UI Test Builder
Coded UI Testing October, 2012 Module 4 Creating a Coded UI Test Using Coded UI Test Builder © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

36 Creating a Coded UI Test Using Coded UI Test Builder
Coded UI Testing October, 2012 Creating a Coded UI Test Using Coded UI Test Builder Test Types Microsoft Test Manager Exploratory Testing Easily reproducing issues through manual testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

37 Microsoft Test Manager
Coded UI Testing October, 2012 Microsoft Test Manager The first time you run MTM it will prompt Add Team Foundation Manager “If you don’t know the Name, contact your administrator” It might require “ServerName:Port Number” © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

38 TFS and MTM Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

39 Connecting Microsoft Test Manager to TFS
Coded UI Testing October, 2012 Connecting Microsoft Test Manager to TFS MTM is always connected to TFS © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

40 Test Plan Properties Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

41 Coded UI Testing October, 2012 MTM Test Suites Static suite: the content of this suite is manually added test cases Query-based suite: a query-based suite lists all test cases matching a given work item filter Requirements-based suite: this suite shows the test cases associated with a selected TFS requirement © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

42 Custom Coded UI Training for Microsoft © GSAtrain
Coded UI Testing October, 2012 Custom Coded UI Training for Microsoft © GSAtrain © GSAtrain

43 Creating a Lab Environment
Coded UI Testing October, 2012 Creating a Lab Environment With Visual Studio 2012 Lab Management it is possible to create an environment based on existing infrastructure without SCVMM This is great because we can now start using Lab Management without any additional installation required The lab machines in a standard environment can be physical or virtual (or both) and the virtual machine does not have to be managed by SCVMM or Hyper- V © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

44 Creating a Lab Environment (continued)
Coded UI Testing October, 2012 Creating a Lab Environment (continued) To create a standard environment you only need to know the names of the machine you want to add to the environment and a user account to be used to log in and deploy the test agent service onto the machine A standard environment can be connected to directly from MTM and the Test Runner making the integration with lab environments really smooth © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

45 Creating a Lab Environment (continued)
Coded UI Testing October, 2012 Creating a Lab Environment (continued) The alternative to standard environments is to use a SCVMM environment The key features of a SCVMM environment include Create new machines from templates New lab machines can automatically be created by anyone (having permissions) running MTM It is no longer required to send a request to the operations department to get machines created for a new environment or to do other maintenance operations such as starting, stopping, snapshotting, or restoring machines © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

46 Creating a Lab Environment (continued)
Coded UI Testing October, 2012 Creating a Lab Environment (continued) Support for snapshots It is possible to work with snapshots from MTM, which enable testers to save state during testing This is a powerful feature both to unlock the tester if a test case fails (no need to block an environment while waiting for a resolution) but also to give a developer a fixed point in time to reproduce a bug © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

47 Creating a Lab Environment (continued)
Coded UI Testing October, 2012 Creating a Lab Environment (continued) Connection inside MTM A SCVMM environment can be connected to MTM and the Test Runner just like with the standard environment © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

48 KPIs For Software Testing
Coded UI Testing October, 2012 KPIs For Software Testing Number of bugs per state How many bugs do we have that are active, resolved, or closed? Are the number of active bugs increasing and number of resolved and closed bugs constant? Then we need to look into how we perform our testing Number of bugs sent back from testers for more information A large number might indicate that communication between developers and testers must improve © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

49 KPIs For Software Testing (continued)
Coded UI Testing October, 2012 KPIs For Software Testing (continued) Code coverage This shows us how much of the code has been covered by our automated unit tests We get the value as a percentage of the whole code Tests run results How are our tests performing? Do we have many failed tests? If so, what can we do to improve this? © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

50 KPIs For Software Testing (continued)
Coded UI Testing October, 2012 KPIs For Software Testing (continued) Percent Requirements covered by test cases Do we write test cases for all our requirements? If not, what is the reason? Percent Requirements covered by testing Do we actually run the tests we have test cases for? If this figure is low and the figure for Percent Requirements covered by test cases is high we might have an issue we need to deal with © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

51 Application Tier: What Does TFS Offer?
Coded UI Testing October, 2012 Application Tier: What Does TFS Offer? First we find all web services for team project collections We all recognize this so no further explanation is necessary: Version control Build service Lab management Work Item tracking Team Foundation Framework services © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

52 Application Tier: What Does TFS Offer? (continued)
Coded UI Testing October, 2012 Application Tier: What Does TFS Offer? (continued) This set of services is running on the Application Tier of TFS and allows us to access the different aspects of Team Foundation Server, including administration, security, and events They enable us to extend Team Foundation functionality by developing TFS extensions and adapters to integrate third-party tools with TFS 2012 © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

53 Custom Coded UI Training for Microsoft © GSAtrain
Coded UI Testing October, 2012 Custom Coded UI Training for Microsoft © GSAtrain © GSAtrain

54 Custom Coded UI Training for Microsoft © GSAtrain
Coded UI Testing October, 2012 Custom Coded UI Training for Microsoft © GSAtrain © GSAtrain

55 Custom Coded UI Training for Microsoft © GSAtrain
Coded UI Testing October, 2012 Custom Coded UI Training for Microsoft © GSAtrain © GSAtrain

56 Coded UI Testing October, 2012 Tester’s Benefits After you have run your tests, you can report on your progress When you use test plans to structure your testing approach, you can answer the following questions: How many tests have passed or failed? How many tests still have to be run for this iteration? When will the testing be complete? Which areas of the product have high test failure rates? © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

57 Tester’s Benefits (continued)
Coded UI Testing October, 2012 Tester’s Benefits (continued) Which test configurations have high test failure rates? Who has the most tests left to be run? Can resources be reallocated to better balance the remaining testing? Which build should the testers be using based on code changes and bug fixes? © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

58 Essential Guide for Running Automated Tests from a Test Plan
Coded UI Testing October, 2012 Essential Guide for Running Automated Tests from a Test Plan © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

59 Coded UI Testing October, 2012 Creating a CUIT You perform the test manually while CUIT Test Builder runs in the Background You can specify the Values that should appear in specific fields The CUIT Test Builder Records actions and generates Code Your Main Skills are in Testing not Coding © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

60 If You Are a Developer… You can extend the CUIT code
Coded UI Testing October, 2012 If You Are a Developer… You can extend the CUIT code The CUIT Test Builder builds Structured Code Straightforward to copy and adapt © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

61 Required Software Visual Studio Ultimate or Visual Studio Premium
Coded UI Testing October, 2012 Required Software Visual Studio Ultimate or Visual Studio Premium © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

62 The 3 Major UI Test Types Planned Exploratory Load and Muli-user
Coded UI Testing October, 2012 The 3 Major UI Test Types Planned Exploratory Load and Muli-user © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

63 Defining Your Testing Effort Using Test Plans
Coded UI Testing October, 2012 Defining Your Testing Effort Using Test Plans Microsoft Test Manager enables you to do three important tasks, as shown in the following illustration: © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

64 Coded UI Testing October, 2012 Exploratory Testing Exploratory testing seeks to find out how the software actually works, and to ask questions about how it will handle difficult and easy cases The quality of the testing is dependent on the tester's skill of inventing test cases and finding defects The more the tester knows about the product and different test methods, the better the testing will be © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

65 Benefits of Exploratory Testing
Coded UI Testing October, 2012 Benefits of Exploratory Testing The main advantage of exploratory testing is that less preparation is needed, important bugs are found quickly, and at execution time, the approach tends to be more intellectually stimulating than execution of scripted tests Another major benefit is that testers can use deductive reasoning based on the results of previous results to guide their future testing on the fly © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

66 Benefits of Exploratory Testing (continued)
Coded UI Testing October, 2012 Benefits of Exploratory Testing (continued) Another benefit is that, after initial testing, most bugs are discovered by some sort of exploratory testing This can be demonstrated logically by stating, "Programs that pass certain tests tend to continue to pass the same tests and are more likely to fail other tests or scenarios that are yet to be explored“ WikiPedia © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

67 DrawBacks of Exploratory Testing
Coded UI Testing October, 2012 DrawBacks of Exploratory Testing Disadvantages are that tests invented and performed on the fly can't be reviewed in advance (and by that prevent errors in code and test cases), and that it can be difficult to show exactly which tests have been run Freestyle exploratory test ideas, when revisited, are unlikely to be performed in exactly the same manner, which can be an advantage if it is important to find new errors; or a disadvantage if it is more important to repeat specific details of the earlier tests Can be controlled with specific instruction to the tester, or by preparing automated tests where feasible, appropriate, and necessary, and ideally as close to the unit level as possible © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

68 Coded UI Testing October, 2012 Exploratory Testing Exploratory testing is particularly suitable if requirements and specifications are incomplete, or if there is lack of time Same approach can also be used to verify that previous testing has found the most important defects © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

69 Custom Coded UI Training for Microsoft © GSAtrain
Coded UI Testing October, 2012 Custom Coded UI Training for Microsoft © GSAtrain © GSAtrain

70 Visual Studio and Exploratory Testing
Coded UI Testing October, 2012 Visual Studio and Exploratory Testing Performing Exploratory Testing Using Microsoft Test Manager In Microsoft Test Manager: Open Testing Center Test Do Exploratory Testing If you don't see the option to “Do Exploratory Testing”, then your team is using a version of TFS prior to 2012 © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

71 Coded User Interface Testing
Coded UI Testing October, 2012 Coded User Interface Testing Automated Functional Tests – Using CUIT Create a CUIT from Scratch Create a CUIT from action recording Making CUIT more Robust and Flexible © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

72 Contents of a Coded UI Test
Coded UI Testing October, 2012 Contents of a Coded UI Test When you create a Coded UI Test, the Coded UI Test Builder creates a map of the user interface under test, and also the test methods, parameters, and assertions for all tests It also creates a class file for each test © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

73 Testing - What is New in VS 2012?
Coded UI Testing October, 2012 Testing - What is New in VS 2012? Conduct exploratory test sessions Locate, view, and edit your test methods, UI actions and their associated controls in the UI control map Quickly track your test plan progress using the Results tab in Microsoft Test Manager Clone your test plan to work on different releases in parallel © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

74 Testing - What is New in VS 2012? (continued)
Coded UI Testing October, 2012 Testing - What is New in VS 2012? (continued) Test Windows Store apps running on a remote device using manual tests or exploratory test sessions Install and configure agents more easily for Lab Management for Visual Studio 2012 Include SCVMM 2012 and clustered Hyper- V hosts in Lab Management for Visual Studio 2012 © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

75 Contents – Test Configurations
Coded UI Testing October, 2012 Contents – Test Configurations © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

76 Configuring Test Settings
Coded UI Testing October, 2012 Configuring Test Settings Establish Environments Diagnostic Connectors Best Practice Work with Development Teams The Developers need to have the same tools to view the test data you collected for them Microsoft released a “Test Attachment Cleaner” available at “Aka.ms./TFPowerTools” © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

77 Using Builds Scout There is an available builds DROPDOWN
Coded UI Testing October, 2012 Using Builds Scout Installing Software and running some initial tests After the SCOUT is successful it can become a “template for other Testers” There is an available builds DROPDOWN Click “ASSIGN TO PLAN” to add a new build to a plan © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

78 Analyzing Impacted Tests
Coded UI Testing October, 2012 Analyzing Impacted Tests Quickly identify tests that need to be run based on changes to code Can Run in the background “Track” menu => Recommended Tests Does not recognize “DATA” changes Does not recognize other library changes Does not recognize other Application changes Best Practice - Periodically run all Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

79 Defining Multiple Test Configurations
Coded UI Testing October, 2012 Defining Multiple Test Configurations Environments may differ: IE 8,9,10 Ipad Horizontal/Vertical BYOD HTML5 Etc. © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

80 Automating Coded UI Test Cases
Coded UI Testing October, 2012 Module 5 Automating Coded UI Test Cases © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

81 Test Cases Are Organized Into Suites
Coded UI Testing October, 2012 Test Cases Are Organized Into Suites Requirements-Based test suite Query-Based test suite Static Test Suite Status of tests in TEST SUITE In planning In Progress Completed © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

82 Coded UI Testing October, 2012 © GSAtrain

83 Unit and Component Tests Functional Tests Exploratory Testing
Coded UI Testing October, 2012 Types of Tests Unit and Component Tests Functional Tests Exploratory Testing Capability Testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

84 Unit and Component Tests
Coded UI Testing October, 2012 Unit and Component Tests Automated tests written to help the team develop software effectively With good suites of unit and component level tests we have the safety net that helps us develop software incrementally in short iterations without breaking existing functionality Invaluable when refactoring code With good test coverage a developer should feel confident to make a change without knowing all about every dependency The tests should tell us if we did anything wrong © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

85 Coded UI Testing October, 2012 Functional Tests Functional tests are mainly our traditional scripted system tests in different flavors It is hard to avoid running these tests manually at first, but we should try to find ways to automate them as we learn more about our product and how it needs to be tested Many functional tests can be automated and then we can focus on early testing for the manual tester © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

86 Coded UI Testing October, 2012 Exploratory Testing Exploratory testing is a form of software testing in which the individual tester can design and run tests in a freer form Instead of following detailed test scripts, the tester explores the system under tests based on the user stories As the tester learns how the system behaves the tester can optimize the testing work and focus more on testing than documenting the test process © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

87 Capability Testing Lastly we have the capability tests
Coded UI Testing October, 2012 Capability Testing Lastly we have the capability tests These tests are run against the behavior of the system; We test non-functional requirements Performance Security These tests are generally automated and run using special purpose tools, such as load test frameworks and security analyzers © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

88 Coded UI Testing October, 2012 Exploratory Testing We should leave this category of tests as manual tests The focus should be to catch bugs that would fall through the net of automated tests A key motivation for automated testing is to let do more of exploratory and usability testing because these tests validate how the end-user feels when using the product © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

89 Custom Coded UI Training for Microsoft © GSAtrain
Coded UI Testing October, 2012 Custom Coded UI Training for Microsoft © GSAtrain © GSAtrain

90 Story Boards A user story can be stated as simply as
Coded UI Testing October, 2012 Story Boards A user story can be stated as simply as As an Employee I want to have an efficient way to manage my expenses The conversation around this statement between the product owner and the development team can raise questions such as: Who can submit expense reports? © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

91 Story Boards (continued)
Coded UI Testing October, 2012 Story Boards (continued) What states can an expense report be in? When is it possible to change or remove an expense report? What data is required in an expense report to register it correctly? Where are the expense reports stored? For how long? © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

92 Adding Detail to User Stories
Coded UI Testing October, 2012 Adding Detail to User Stories An expense report has the following state model: New when created Pending after submitted for approval Approved Rejected © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

93 Story Boards Are Vital to Testing
Coded UI Testing October, 2012 Story Boards Are Vital to Testing Allows the Tester to Verify what should happen If this does not Happen… See the Tasks that were assigned to this requirement See the Programmers assigned to Each Task Notify the Developer(s) Provide the necessary info to avoid “NO REPRO” Add this Test to the “Suite” © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

94 Coded UI Testing October, 2012 Hands-On Lab Introduction to Test Planning with Microsoft Test Manager 2012 Authoring Test Cases © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

95 Module 6 Data Driven Tests Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

96 Data Driven Tests Any Files Used in The Tests
Coded UI Testing October, 2012 Data Driven Tests Any Files Used in The Tests Example XML to load Variable and Expected Data Could be: SQL Business Connectivity Services SharePoint Lists SQL Reports Excel / PowerPivot SSAS © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

97 Uses of Data Driven Tests
Coded UI Testing October, 2012 Uses of Data Driven Tests Create errors Add new Cases Modify the rows Automation can be changed by using different files © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

98 Hands-On Lab How to Create a Data-Driven Coded UI Test
Coded UI Testing October, 2012 Hands-On Lab How to Create a Data-Driven Coded UI Test © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

99 The UNFORTUNATE REALITY
Coded UI Testing October, 2012 The UNFORTUNATE REALITY 70% of all Application Testing is MANUAL © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

100 Anatomy of Coded UI Tests
Coded UI Testing October, 2012 Module 7 Anatomy of Coded UI Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

101 Anatomy of Coded UI Tests
Coded UI Testing October, 2012 Anatomy of Coded UI Tests When you create a Coded UI Test, the Coded UI Test Builder creates a map of the user interface under test, and also the test methods, parameters, and assertions for all tests It also creates a class file for each test us/library/ff aspx © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

102 Contents of a Coded UI Test
Coded UI Testing October, 2012 Contents of a Coded UI Test File Contents Editable? UIMap.Designer.cs Declarations section UIMap class (partial, auto-generated) Methods Properties No UIMap.cs UIMap class (partial) Yes CodedUITest1.cs CodedUITest1 class UIMap.uitest The XML map of the UI for the test. © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

103 Contents of Coded UI Test (continued)
Coded UI Testing October, 2012 Contents of Coded UI Test (continued) UIMap.Designer.cs This file contains code that is automatically created by the Coded UI Test Builder when a test is created This file is re-created every time that a test changes, so that it is not a file in which you can add or modify code © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

104 Coded UI Testing October, 2012 Declarations section using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Drawing; using System.Text.RegularExpressions; using System.Windows.Input; using Microsoft.VisualStudio.TestTools.UITest.Extension; using Microsoft.VisualStudio.TestTools.UITesting; using Microsoft.VisualStudio.TestTools.UITesting.WinControls; using Microsoft.VisualStudio.TestTools.UnitTesting; using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard; using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse; using MouseButtons = System.Windows.Forms.MouseButtons © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

105 Introduction to Lifecycle Management
Coded UI Testing October, 2012 Module 8 Introduction to Lifecycle Management © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

106 Coded UI Testing October, 2012 Visual Studio 2012 Visual Studio Ultimate, Visual Studio Premium and Test Professional include a Microsoft Test Manager To help you define and manage your testing effort by using test plans You create a test plan and add any test suites, test cases, or configurations that you need © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

107 Coded UI Testing October, 2012 Lifecycle Management By using the suite of tools in Visual Studio 2012, and combining those tools with Visual Studio Team Foundation Server, you can apply proven practices to manage your application's lifecycle, from understanding customer needs through code design and implementation to deployment You can use the instrumentation in these tools to trace requirements to checked-in code, builds and test results © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

108 Lifecycle Management (continued)
Coded UI Testing October, 2012 Lifecycle Management (continued) These practices can help your team create software that is valued by your customers and that is faster and more reliable. You can use these tools to achieve the following results: Visual Studio Application Lifecycle Management (ALM) provides you and your team with the tools to effectively manage the lifecycle to develop applications As the following illustration shows, you and your team can use these tools to tell user stories, to manage the backlog, plan a sprint, and run a sprint, to engage stakeholders to provide continuous feedback, and to easily incorporate feedback to support the next iteration of software © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

109 ALM Cycles Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

110 What's New for ALM in Visual Studio 2012?
Coded UI Testing October, 2012 What's New for ALM in Visual Studio 2012? us/library/bb aspx © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

111 Visual Studio 2010 to 2012: Completely Restructured Software Testing
Coded UI Testing October, 2012 Visual Studio 2010 to 2012: Completely Restructured Software Testing In 2012 Visual Studio Improves: Integration between testing and the rest of the Software Development lifecycle Example – Better handoff from tester to developer Less NO REPRO Improved build-deploy-test workflow Improved Virtualization © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

112 Types of Tests Supported by VS 2012
Coded UI Testing October, 2012 Types of Tests Supported by VS 2012 Manual Tests Coded UI Tests Unit Tests Web Performance Tests Load Tests Generic Tests Ordered Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

113 Testing Pyramid Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

114 Testing Structures Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

115 Using Shared Steps Demo LAB Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

116 Assigning Configurations
Coded UI Testing October, 2012 Assigning Configurations Demo © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

117 Manual Tests Require a Human to Interact with an application
Coded UI Testing October, 2012 Manual Tests Require a Human to Interact with an application Verify some expected result Report on the success of the test © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

118 Coded UI Testing October, 2012 Coded UI Tests Provides the Capability to author tests that automatically interact with user interface Verify Results File Bug Report It can be run Frequently without human intervention Typically more expensive to author and maintain than manual test © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

119 Unit Tests Used by Programmers for Programmers
Coded UI Testing October, 2012 Unit Tests Used by Programmers for Programmers Quickly becoming the standard practice A vital part of Test-Driven Development Generally focus on a lower level than other Testing Ideally a unit is the smallest atomic part - One method of One object © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

120 Unit Tests (continued)
Coded UI Testing October, 2012 Unit Tests (continued) Test written before the object It will initially fail Correct Re-test Refactor Repeat Essential component of Regression Testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

121 Web Performance Tests Verify that the web site is behaving as expected
Coded UI Testing October, 2012 Web Performance Tests Verify that the web site is behaving as expected Add load to see if the application is still capable of Scaling © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

122 Load Tests Tests that Application Scales and Performs as Necessary
Coded UI Testing October, 2012 Load Tests Tests that Application Scales and Performs as Necessary © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

123 Generic Tests Calling external testing systems
Coded UI Testing October, 2012 Generic Tests Calling external testing systems Results can be automatically parsed to determine success Could be simple console application to XML document exported from LOB © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

124 Ordered Tests Container for other tests Specific order of tests
Coded UI Testing October, 2012 Ordered Tests Container for other tests Specific order of tests Some run more than once © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

125 Diagnostic Data Adapters
Coded UI Testing October, 2012 Diagnostic Data Adapters The Key challenge of Testers Provide Developers with sufficient information to reproduce the problem Most Bugs result in No Repro “It Works on my machine” © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

126 Diagnostic Data Adapters
Coded UI Testing October, 2012 Diagnostic Data Adapters A Diagnostic Data Collector is responsible for collecting data about the machine under test Action Log ASP.NET Profiler Code Coverage IntelliTrace Event Log System Information Test Impact Video Recorder Network Emulation © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

127 Developers view Test-Driven Development Unit Testing Coded UI Testing
October, 2012 Developers view Test-Driven Development Unit Testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

128 Test-driven development (TDD) WikiPedia
Coded UI Testing October, 2012 Test-driven development (TDD) WikiPedia Is a software development process that relies on the repetition of a very short development cycle: First the developer writes an (initially failing) automated test case That defines a desired improvement or new function Then produces the minimum amount of code to pass that test Refactors the new code to acceptable standards © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

129 Tester’s View Whole Application Testing Not Unit Testing
Coded UI Testing October, 2012 Tester’s View Not Unit Testing Not Integration Testing Not Regression Testing Whole Application Testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

130 Requirements-Driven Testing
Coded UI Testing October, 2012 Requirements-Driven Testing When requirements or user stories, or features are ready to be tested, you can run your tests for each configuration that you specified UI – User Interface Testing Usability - Testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

131 Components of Coded UI Testing
October, 2012 Components of Coded UI Testing Test Runner: The Test Runner from MTM can create action recordings from a manual test The action recording can later be used to play back the test session in MTM or to generate a Coded UI test from the recorded steps Coded UI Test: The implementation of the actual test written in C# or VB.NET The Coded UI Test is either generated by the Coded UI Test builder code generator or coded directly against the Coded UI Test API © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

132 Components of Coded UI Testing (continued)
October, 2012 Components of Coded UI Testing (continued) Test Recorder: Records actions from a test session, which then can be used by the Test Runner to automate a generated test or by the coded generator to create a Coded UI test Coded UI Test API: The Coded UI Test API can be used to create UI tests which are more tightly connected to the UI elements © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

133 Components of Coded UI Testing (continued)
October, 2012 Components of Coded UI Testing (continued) Technology Managers: These are the core components responsible for mapping UI elements to the underlying technology (i.e. web browser or a rich client) We can implement custom plug-ins to support platforms which the native plug-ins does not support © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

134 Custom Coded UI Training for Microsoft © GSAtrain
Coded UI Testing October, 2012 Custom Coded UI Training for Microsoft © GSAtrain © GSAtrain

135 Managing Automated Tests
Coded UI Testing October, 2012 Managing Automated Tests These tests are critical to project success The number keeps growing Regression testing is vital Sometimes hundreds or even thousand of tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

136 Supported Platforms Internet Explorer 8, 9, 10
Coded UI Testing October, 2012 Supported Platforms Internet Explorer 8, 9, 10 Windows Forms 2.0 and later WPF 3.5 and later Windows Win32 (not officially supported but may work) MFC (partially) SharePoint (partially) Dynamics CRM Citrix/Terminal Services (partially) PowerBuilder (partially) © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

137 Coded UI Test Builder Interface
Coded UI Testing October, 2012 Coded UI Test Builder Interface © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

138 Parameterized Testing
Coded UI Testing October, 2012 Parameterized Testing A common requirement of automated tests is to be able to run the test a number of times with different parameters We have already looked at how we can work with data- driven test in details The same techniques are valid for coded UI tests as well except that the data source for a UI test often points to the data set managed in the associated test case Using the test case to manage test data for the automated test is nice because then the tester can update the data directly from inside MTM © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

139 Coded UI Testing October, 2012 Regression Testing Coded UI tests are probably the ideal type of test for regression testing because they give us the opportunity to automatically test the system just like a real user would But there are a number of issues that make UI tests difficult as a general purpose solution for automation solution, including Requires a UI Requires a desktop session to run UI tests are more complex to design and maintain Difficult to scale © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

140 “Under-the-UI” Testing
Coded UI Testing October, 2012 “Under-the-UI” Testing To work around these challenges we generally recommend considering “under- the-UI” tests as a complement to the UI tests These tests could be written against the APIs in the system or against the controller layer in an MVC style of application © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

141 Test Case Management Command-Line Tool
Coded UI Testing October, 2012 Test Case Management Command-Line Tool Another option for running tests from the command-line is to use the Test Case Management command-line tool, TCM.exe This tool is installed under C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TCM.exe There are several options for us to start a test run, for instance: Run all tests in a test suite Locate the Suite Id from the test suite in MTM tcm run /create /title:"UI Test Run" /planid:5 /suiteid:11 /configid:2 /collection:http://tfs.kangreen.com:8080/tfs /teamproject:"Expense Reporting" © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

142 Test Case Management Command-Line Tool (continued)
Coded UI Testing October, 2012 Test Case Management Command-Line Tool (continued) You can use tcm.exe to figure out the Ids for plans, suites, and configurations as well: •List plans tcm plans /list /collection:http://tfs.kangreen.com:8080/tfs /teamproject:"Expense Reporting" •List suites tcm suites /list /collection:http://tfs.kangreen.com:8080/tfs /teamproject:"Expense Reporting" •List configurations tcm configs /list /collection:http://tfs.kangreen.com:8080/tfs /teamproject:"Expense Reporting" © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

143 Demo Creating a Test Project
Coded UI Testing October, 2012 Demo Creating a Test Project Studio-2012-Premium-and-Ultimate- Overview/Visual-Studio-Ultimate Easily-testing-user-interfaces-with- Coded-UI-tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

144 Components of a Test Plan
Coded UI Testing October, 2012 Components of a Test Plan © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

145 Benefits of Automated Testing
Coded UI Testing October, 2012 Benefits of Automated Testing Automated tests can quickly test whether your application is still working correctly after code changes have been made to your application Automating Test should not take more than about 40% of team members' time © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

146 The Achilles’ Heel of Automated Tests
Coded UI Testing October, 2012 The Achilles’ Heel of Automated Tests The problem with user interface tests is not in how to execute them, but what to test Since human testers would often check the whole round-trip of information, from the GUI to the back-end report First instinct is to replicate that and try to verify business domain rules. This is the Achilles’ heel of UI tests, and it ultimately leads to enormous waste of time © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

147 UI Testing Without Shooting Yourself in the Foot
Coded UI Testing October, 2012 UI Testing Without Shooting Yourself in the Foot © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

148 Thinking About These Different Levels
Coded UI Testing October, 2012 Thinking About These Different Levels The idea of thinking about these different levels is good because it allows us to write UI-level tests that are easy to understand Efficient to write Relatively inexpensive to maintain © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

149 Thinking About These Different Levels (continued)
Coded UI Testing October, 2012 Thinking About These Different Levels (continued) Checking that delivery is available for two books involves putting a book in a shopping cart Putting a book in a shopping cart involves a sequence of technical steps Entering address details does as well Breaking things down like that and combining lower level concepts into higher level concepts reduces the cognitive load and promotes reuse © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

150 Using Microsoft Test Manager
Coded UI Testing October, 2012 Using Microsoft Test Manager You can plan, manage and execute both manual and exploratory tests You can also automate your manual tests after they are stabilized While you are performing manual and exploratory tests, you can log bugs The bug will contain a trace of your recent actions, a snapshot of the state of the system, and a copy of any notes you made while exploring the system You can record your actions in the test case, so that they can be played back on later occasions © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

151 Manual to Coded UI Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

152 Extending Coded UI Tests and Action Recordings
Coded UI Testing October, 2012 Module 9 Extending Coded UI Tests and Action Recordings © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

153 Extending Coded UI Tests and Action Recordings
Coded UI Testing October, 2012 Extending Coded UI Tests and Action Recordings Supported Configurations us/library/dd aspx © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

154 Upgrading Coded UI Tests from Visual Studio 2010
Coded UI Testing October, 2012 Module 10 Upgrading Coded UI Tests from Visual Studio 2010 © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

155 Extending Coded UI Tests and Action Recordings
Coded UI Testing October, 2012 Module 11 Extending Coded UI Tests and Action Recordings © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

156 Coded UI Testing October, 2012 Extending Coded UI Tests and Action Recordings to Support Microsoft Excel The testing framework for coded UI tests and action recordings does not support every possible user interface It might not support the specific UI that you want to test For example, you cannot immediately create a coded UI test or an action recording for a Microsoft Excel spreadsheet However, you can create your own extension to the coded UI test framework that will support your specific UI by taking advantage of the extensibility of the coded UI test framework © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

157 Coded UI Testing October, 2012 Extending Coded UI Tests and Action Recordings to Support Microsoft Excel (continued) The following topic gives an example of how to extend the framework to support the creation of coded UI tests and action recordings for Microsoft Excel For more information about the platforms that are supported, see Supported Configurations and Platforms for Coded UI Tests and Action Recordings This section presents a coded UI test extension that can record and play back tests of Excel Worksheets Each part of the extension is explained in this section and in the code comments for developers who want to create just such an extension © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

158 Architecture Overview
Coded UI Testing October, 2012 Architecture Overview © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

159 Testing Large Applications with Multiple UI Maps
Coded UI Testing October, 2012 Module 12 Testing Large Applications with Multiple UI Maps © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

160 Using HTML5 Controls in Coded UI Tests
Coded UI Testing October, 2012 Module 13 Using HTML5 Controls in Coded UI Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

161 Using WPF with Coded UI Tests
Coded UI Testing October, 2012 Module 14 Using WPF with Coded UI Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

162 Best Practices for Coded UI Tests
Coded UI Testing October, 2012 Module 15 Best Practices for Coded UI Tests © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

163 Best Practices For Coded UI Tests
Coded UI Testing October, 2012 Best Practices For Coded UI Tests Use the Coded UI Test Builder whenever possible Do not modify the UIMap.designer.cs file directly. If you do this, the changes to the file will be overwritten Create your test as a sequence of recorded methods. For more information about how to record a method, see Creating Coded UI Tests Each recorded method should act on a single page, form, or dialog box Create a new test method for each new page, form, or dialog box © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

164 Best Practices For Coded UI Tests (continued)
Coded UI Testing October, 2012 Best Practices For Coded UI Tests (continued) When you create a method, use a meaningful method name instead of the default name A meaningful name helps identify the purpose of the method When possible, limit each recorded method to fewer than 10 actions This modular approach makes it easier to replace a method if the UI changes Create each assertion using the Coded UI Test Builder, which automatically adds an assertion method to the UIMap.Designer.cs file © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

165 Best Practices For Coded UI Tests (continued)
Coded UI Testing October, 2012 Best Practices For Coded UI Tests (continued) If the user interface (UI) changes, re-record the test methods, or the assertion methods, or re-record the affected sections of an existing test method Create a separate UIMap file for each module in your application under test. For more information, see Testing a Large Application with Multiple UI Maps In the application under test, use meaningful names when you create the UI controls This gives more meaning and usability to the automatically generated control names © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

166 Best Practices For Coded UI Tests (continued)
Coded UI Testing October, 2012 Best Practices For Coded UI Tests (continued) If you are creating assertions by coding with the API, create a method for each assertion in the part of the UIMap class that is in the UIMap.cs file Call this method from your test method to execute the assertion If you are directly coding with the API, use the properties and methods in the classes generated in the UIMap.Designer.cs file in your code as much as you can These classes will make your work easier, more reliable, and will help you be more productive © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

167 What to Do If Your User Interface Changes
Coded UI Testing October, 2012 What to Do If Your User Interface Changes User interfaces frequently change during development Here are some ways to reduce the effect of these changes: Find the recorded method which references this control and use the Coded UI Test Builder to re- record the actions for this method You can use the same name for the method to overwrite the existing actions © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

168 What to Do If Your User Interface Changes (continued)
Coded UI Testing October, 2012 What to Do If Your User Interface Changes (continued) If a control has an assertion that is no longer valid: Delete the method that contains the assertion Remove the call to this method from the test method Add a new assertion by dragging the cross- hair button onto the UI control, open the UI map, and add the new assertion © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

169 Coded UI Testing October, 2012 What To Do If A Background Process Needs to Complete Before The Test Can Continue // Set the playback to wait for all threads to finish Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads; // Press the submit button this.UIMap.ClickSubmit(); // Reset the playback to wait only for the UI thread to finish Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.UIThreadOnly; © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

170 Using the Coded UI Test Logs
Coded UI Testing October, 2012 Using the Coded UI Test Logs archive/2012/06/05/enabling-coded-ui- test-playback-logs-in-visual-studio release-candidate.aspx What's New for Application Lifecycle Management in Visual Studio 2012 Visual Studio 2012 Other Versions Visual Studio 2010 Visual Studio 2008 2 out of 2 rated this helpful - Rate this topic You can use Visual Studio Application Lifecycle Management (ALM) to manage your product lifecycle, reduce risks, and improve efficiencies. When you install or upgrade to Visual Studio Team Foundation Server 2012, you and your team can benefit from the new features and supported tasks outlined in the following table. Lifecycle area New features and supported tasks Planning and Tracking Create and manage the product backlog, sprints, and tasks. Run daily standups with a task board. Support multiple teams within a team project. Engage stakeholders to provide feedback about pre-release software. Illustrate requirements with PowerPoint Storyboarding and link storyboards to work items. Manage enterprise project portfolios and access up-to-date project status and resource availability using Microsoft Project Professional and Project Server. Architecture, Modeling, and Design Create, read, and edit dependency graphs faster and more easily. Get more information about your work by opening and viewing linked model elements in work items. Communicate with others about the design by creating UML class diagrams from C# code. Implement your design more quickly by generating C# code from UML class diagrams. Import UML class, use case, and sequence diagram elements from XMI 2.1 files. Developer Tools Work more efficiently by organizing work and reducing the impact of interruptions using My Work and Pending Changes. Enhance transparency and collaborate more effectively to product quality code using Code Review. Integrate testing into the developer workflow using Test Explorer. Find duplicated code in a solution with Code Clone Analysis. Collect diagnostic data for applications running on computers that don't have Visual Studio by using the IntelliTrace standalone data collector. Review Web requests in IntelliTrace recordings for ASP.NET Web applications hosted on IIS 7.0 or later. Easily debug code generated from text templates. Quickly customize the code generator by writing Visual Studio extensions. Testing Conduct exploratory test sessions. Locate, view, and edit your test methods, UI actions and their associated controls in the UI control map. Quickly track your test plan progress using the Results tab in Microsoft Test Manager. Clone your test plan to work on different releases in parallel. Test Windows Store apps running on a remote device using manual tests or exploratory test sessions. Install and configure agents more easily for Lab Management for Visual Studio 2012. Include SCVMM 2012 and clustered Hyper-V hosts in Lab Management for Visual Studio 2012. Team Foundation Build Define and run automated build processes in a hosted deployment of TFS by connecting it to an on-premises or hosted build controller. Increase the efficiency of your gated check-in build process by configuring it to build multiple check-ins at the same time. Run native and third-party framework unit tests using Visual Studio Test Runner or RunTests in a custom build process. Easily access, organize, and get information about the builds that matter most to you using the Builds page in Team Explorer. Debug builds more easily. Version Control Work in local workspaces either in or outside of Visual Studio, even when you're not connected to Team Foundation Server. Manage your work, reduce the impact of interruptions, and facilitate collaboration with your team with My Work and Pending Changes pages in Team Explorer. Conduct and track reviews of active, suspended, or checked-in code. Manage shelvesets and changesets using My Work and Pending Changes. Review and modify code changes more easily using the enhanced Diff window. © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

171 Module 17 Evolution of Testing Coded UI Testing October, 2012
© GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

172 Evolution of Testing In-Line Programs Sub-Routines Functions
Coded UI Testing October, 2012 Evolution of Testing In-Line Programs Sub-Routines Functions Time Sharing On-Line Terminals Client Sever 3 Tier Architecture Thin Client MVC SOA © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

173 De Coupling of Software Testing
Coded UI Testing October, 2012 De Coupling of Software Testing Developers – View Individual Units of Code Administrators Build Environments and Versions Testers Test Complete Applications © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

174 Primary Drivers of SOA Inability of TESTERS to test BlackBox Code
Coded UI Testing October, 2012 Primary Drivers of SOA Inability of TESTERS to test BlackBox Code 10,000 lines of code could result in 1 Million Routes Impossible to Test Interface – Contract testing – is practical CLOUD increases the environment exponentially Interfaces are constant © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

175 Microsoft’s Commitment To The Cloud
Coded UI Testing October, 2012 Microsoft’s Commitment To The Cloud Microsoft Windows 2012 Windows 8 Office 2013 Office365 SQL 2012 SharePoint 2012 LINQ 2012 are all Cloud – SOA Oriented © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

176 Azure Services The platform includes five services:
Coded UI Testing October, 2012 Azure Services The platform includes five services: Live Services for communication and collaboration services SQL Azure (formerly SQL Services) for data-storage services AppFabric (formerly .NET Services) for cloud-computing services SharePoint Services for web-content-management and document-management services Dynamics CRM Services for customer-relationship- management services © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

177 Testing is Moving To The CLOUD
Coded UI Testing October, 2012 Testing is Moving To The CLOUD Microsoft TFS is now Cloud Based © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

178 Coded UI Testing October, 2012 © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

179 Benefits of TFS in the Cloud
Coded UI Testing October, 2012 Benefits of TFS in the Cloud Collaboration is the Key to TFS Developers Testers – Creating Reproducible Automated Tests Administrators – Builders of (Virtual Machines and Versions) Using TFS in the cloud can help us enhance collaboration It can also enhance collaboration in an organization with geographically spread locations © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

180 Concerns with TFS in the Cloud
Coded UI Testing October, 2012 Concerns with TFS in the Cloud With TFS in the cloud is that we can neither add our own process template nor make adjustments to the existing templates © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

181 Service Oriented Architecture
Coded UI Testing October, 2012 Service Oriented Architecture Interface Testing Viewing Objects from the outside Leads to Unit Testing Test-Driven Design © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

182 IT Has a Problem! ACCELERATING RATE OF CHANGE Coded UI Testing
October, 2012 IT Has a Problem! ACCELERATING RATE OF CHANGE © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

183 Reasons for SOA Rapid Adoption
Coded UI Testing October, 2012 Reasons for SOA Rapid Adoption © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

184 What is the Relationship Between Cloud and SOA
Coded UI Testing October, 2012 What is the Relationship Between Cloud and SOA The short answer is: Cloud is an initial application of SOA to infrastructure --its setup, configuration, monitoring , management , with the essential elements of metering and billing added to satisfy the goal of a charge model of e.g., pay-as-you-go -- the specific requirements for XaaS: resource pooling and virtualization , elasticity and multi-tenancy, dynamic configuration and provisioning Cloud paradigm leverages SOA to deliver a charge-based model for non-business specific services; -- infrastructure/hardware -- software --platform https://www.ibm.com/developerworks/mydeveloperworks/blogs/AliArsanjani/?order=asc&maxresults =15&sortby=0&lang=en © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

185 Coded UI Testing October, 2012 SIMM https://www2.opengroup.org/ogsys/publications/viewDocument.html?publicationid=12450&documentid=11340 © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

186 DOD is Insisting on SOA Vulnerabilities Security Testing
Coded UI Testing October, 2012 DOD is Insisting on SOA Vulnerabilities Security Testing © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

187 Definition of a Service
Coded UI Testing October, 2012 Definition of a Service Discoverable Self-Describing Composable Loose Coupling Governed by Policy Independent of Location, Language and Protocol © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

188 SOA Maturity Model Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

189 IT Benefits Of SOA Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

190 SOA Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

191 SOA Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

192 SOA Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain

193 Coded UI Testing October, 2012 © GSAtrain Custom Coded UI Training for Microsoft © GSAtrain

194 SOA Coded UI Testing October, 2012 © GSAtrain
Custom Coded UI Training for Microsoft © GSAtrain


Download ppt "Coded UI Testing Clive G Hermann"

Similar presentations


Ads by Google