Getting Started with Coded UI Testing:Building Your First Automated TestImaginet Resources Corp.www.imaginet.com
Agenda• Coded UI Test Overview• Recording Coded UITests• Adding Test Validation• Writing your own code• Best Practices
Coded UI Test Tools• Used to automate testing from the user interface• Test development/maintenance in Visual Studio• Tool...
Supported Platforms• Supported (2012 RTM)– Windows Forms 2.0+– WPF 3.5+– SharePoint– Internet Explorer 8.0, 9.0– Internet ...
Agenda• Coded UI Test Overview• Recording Coded UITests• Adding Test Validation• Writing your own code• Best Practices
Creating Coded UI TestsAction Recordingfrom Manual TestsVisual StudioTest BuilderVisual Studio(Hand Coded)Coded UI Test
Option 1: Based on Existing Tests• Using Microsoft Test Manager (MTM)…– Analyst defines requirements– Tester defines manua...
Option 2: Using the Coded UI Test Builder• Approach:– Click the record button– Perform the steps in your test target– Clic...
DEMONSTRATION• Converting Test Cases• Recording tests with theCoded UI Test Builder
Option 3: Author Tests using .NET• Hand-code in .NET, without any additional assistance• Utilize one of the Coded UI-based...
Agenda• Coded UI TestOverview• Recording Coded UITests• Adding Test Validation• Writing your owncode• Best Practices
Validation• Use the Coded UI Test Builderto add assertions• Drag the crosshairs to a targetcontrol• Bundle assertions into...
DEMONSTRATION• Adding Assertions
Agenda• Coded UI Test Overview• Recording Coded UI Tests• Adding Test Validation• Writing your own code• Best Practices an...
The Primary Components• Test Class (e.g., MyTest.cs)– A .NET Coded UI Test class containing one or more TestMethods.• Test...
Overriding Generated Properties[TestMethod]public void CodedUITestMethod1(){this.UIMap.OpenCalc();this.UIMap.AddThreeAndTw...
The APIMicrosoft.VisualStudio.TestingTools.UITesting:• UITestControl• Keyboard– SendKeys• Mouse• Playback.PlaybackSettings...
DEMONSTRATION• Digging into the Code
Agenda• Coded UI Test Overview• Recording Coded UI Tests• Adding Test Validation• Writing your own code• Best Practices
Best Practices• Create each test case as a sequence of Recorded Methods.• Use multiple UI Maps to separate areas o the app...
Summary• Coded UI Test Overview• Recording Coded UI Tests• Adding Test Validation• Writing your own code• Best Practices
Questions?
Want to know more...?
Imaginet‟s New Blog Keeps You In The Knowhttp://blog.imaginet.comStay up to speed on the latest news fromImaginet, Microso...
More Webcasts on ALM / TFS / Visual Studio 2012• Quality Coding: What’s New with Visual Studio 2012• April 18 (1:00-2:30pm...
Free Services from Imaginet & MicrosoftThere are a number of different Microsoft Programs that youmight be able to leverag...
Need Help with YOUR Automated Testing?• Learn best practices for test selection, extension, databinding, maintenance, fram...
Email us at:ALM Planning & Implementation ServicesALM Planning• ALM Assessment & Envisioning Workshops(3 or 5 days)• VS & ...
For questions or more information,please contact us at:info@imaginet.com or (972)607-4830Remember to add http://blog.imagi...
http://www.imaginet.com
Upcoming SlideShare
Loading in...5
×

Getting Started with Visual Studio’s Coded UI Testing: Building Your First Automated Test

1,027

Published on

This training seminar demonstrates how to record tests run against various types of application user interfaces using Microsoft Visual Studio’s Coded UI Tests and how to replay them at any time. Additionally, we explore how to embed validations, either simple or elaborate, to ensure your application is producing the correct results. Learn how to improve the quality of your applications by having a repeatable set of Microsoft Coded UI Tests available to ensure defects don’t go unnoticed!

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,027
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • This training seminar will demonstrate how to record tests run against various types of application user interfaces using Microsoft Visual Studio's Coded UI Tests and how to replay them at any time. Additionally, we will explore how to embed validations, either simple or elaborate, to ensure your application is producing the correct results. Learn how to improve the quality of your applications by having a repeatable set of Microsoft Coded UI Tests available to ensure defects don’t go unnoticed!
  • Extensible framework. Sample shows testing support for MS ExcelUpdated, source: http://msdn.microsoft.com/en-us/library/dd380742.aspxFirefox dropped: http://msdn.microsoft.com/en-us/library/hh506981.aspx---
  • Source: http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.uitesting.aspx
  • Source: http://msdn.microsoft.com/en-us/library/dd380782.aspx
  • Want to know more?
  • Want to know more?
  • Transcript of "Getting Started with Visual Studio’s Coded UI Testing: Building Your First Automated Test"

    1. 1. Getting Started with Coded UI Testing:Building Your First Automated TestImaginet Resources Corp.www.imaginet.com
    2. 2. Agenda• Coded UI Test Overview• Recording Coded UITests• Adding Test Validation• Writing your own code• Best Practices
    3. 3. Coded UI Test Tools• Used to automate testing from the user interface• Test development/maintenance in Visual Studio• Tools provided to improve creation and maintenanceof Coded UI tests• Can author and maintain tests without writing code orcan extend tests using .NET• Can run within Visual Studio or through automation(e.g., a build)Test development and maintenance from withinVisual Studio
    4. 4. Supported Platforms• Supported (2012 RTM)– Windows Forms 2.0+– WPF 3.5+– SharePoint– Internet Explorer 8.0, 9.0– Internet Explorer 10.0(Desktop)– Dynamix CRM web client• Supported (2012 Update 1)– Google Chrome 21+– Firefox 15+• Unsupported but may work– Windows Win32• Partially Supported– MFC– Dynamix (Ax) 2012 Client– Citrix / Terminal Services– PowerBuilder• Unsupported– Internet Explorer < 8.0– Silverlight– Flash/Java– SAP– Microsoft Office– Apple Safari– Opera
    5. 5. Agenda• Coded UI Test Overview• Recording Coded UITests• Adding Test Validation• Writing your own code• Best Practices
    6. 6. Creating Coded UI TestsAction Recordingfrom Manual TestsVisual StudioTest BuilderVisual Studio(Hand Coded)Coded UI Test
    7. 7. Option 1: Based on Existing Tests• Using Microsoft Test Manager (MTM)…– Analyst defines requirements– Tester defines manual test cases for the requirement– Tester runs test cases and records the steps• As needed, “Automation Tester” converts recordedsteps into a Coded UI TestDefineRqtsDefineTestsCaptureTestsAutomateTests
    8. 8. Option 2: Using the Coded UI Test Builder• Approach:– Click the record button– Perform the steps in your test target– Click the generate code button– Repeat to generate more methods for the test– Show recorded steps to delete missteps
    9. 9. DEMONSTRATION• Converting Test Cases• Recording tests with theCoded UI Test Builder
    10. 10. Option 3: Author Tests using .NET• Hand-code in .NET, without any additional assistance• Utilize one of the Coded UI-based community frameworks:– CUITe (Coded UI Test Enhanced)• Authored by Microsoft employees but not a „product‟• Uses its own tooling to maintain a separate UI object repository• Improves code maintainability• Browser-based only• Currently only supported on Visual Studio 2010• Maintained on CodePlex:http://cuite.codeplex.com/– Code First Coded UI• Led by Microsoft employees but not a „product‟• Pure code – does not use an object repository• Installable via NuGet• Uses Scaffolding approach to generate tests• Browser-based only• Currently only supported on Visual Studio 2010• Maintained on CodePlex:http://codeduicodefirst.codeplex.com/
    11. 11. Agenda• Coded UI TestOverview• Recording Coded UITests• Adding Test Validation• Writing your owncode• Best Practices
    12. 12. Validation• Use the Coded UI Test Builderto add assertions• Drag the crosshairs to a targetcontrol• Bundle assertions intomethods called from the testSelect apropertyClick to addassertionGenerate a methodto record theassertion(s)
    13. 13. DEMONSTRATION• Adding Assertions
    14. 14. Agenda• Coded UI Test Overview• Recording Coded UI Tests• Adding Test Validation• Writing your own code• Best Practices andReferences
    15. 15. The Primary Components• Test Class (e.g., MyTest.cs)– A .NET Coded UI Test class containing one or more TestMethods.• Test Method– An individual automated test case inside a Test Class.• Recorded Method– Code which actually automates the UI and performsassertions. (Do not change this code!)• UIMap– An XML designer file and related generated classes containingthe recorded methods.
    16. 16. Overriding Generated Properties[TestMethod]public void CodedUITestMethod1(){this.UIMap.OpenCalc();this.UIMap.AddThreeAndTwo();this.UIMap.VerifySumExpectedValues.UITxtDisplayEditText = "5";this.UIMap.VerifySum();this.UIMap.CloseCalc();}“Recorded Methods”created using the UI TestBuilder.Hand-coded to change theexpected value for the VerifySumrecorded method. There are manyother overrides made available toyou in the generated code.
    17. 17. The APIMicrosoft.VisualStudio.TestingTools.UITesting:• UITestControl• Keyboard– SendKeys• Mouse• Playback.PlaybackSettings…– DelayBetweenActions– MatchExactHierarchy– SearchInMinimizedWindows– SearchTimeout– ThinkTimeMultiplier– WaitForReadyLevel– WaitForReadyTimeout
    18. 18. DEMONSTRATION• Digging into the Code
    19. 19. Agenda• Coded UI Test Overview• Recording Coded UI Tests• Adding Test Validation• Writing your own code• Best Practices
    20. 20. Best Practices• Create each test case as a sequence of Recorded Methods.• Use multiple UI Maps to separate areas o the application.• Use meaningful test method names.• Try to limit the length of each recorded method to lessthan 10 actions.• Use meaningful UI control names in the application undertest.• Do not edit the UIMap.Designer.cs file.• Use the Coded UI Test Builder and UI Control Locatorwhenever possible.
    21. 21. Summary• Coded UI Test Overview• Recording Coded UI Tests• Adding Test Validation• Writing your own code• Best Practices
    22. 22. Questions?
    23. 23. Want to know more...?
    24. 24. Imaginet‟s New Blog Keeps You In The Knowhttp://blog.imaginet.comStay up to speed on the latest news fromImaginet, Microsoft, Visual Studio, and the entire softwaredevelopment world.
    25. 25. More Webcasts on ALM / TFS / Visual Studio 2012• Quality Coding: What’s New with Visual Studio 2012• April 18 (1:00-2:30pm CT)• May 9 (1:00-2:30pm CT)• May 23 (1:00-2:30pm CT)• Getting Started With Coded UI testing: Building Your FirstAutomated Test• April 11 (1:00-2:30pm CT)• April 25 (1:00-2:30pm CT)• June 13 (1:00-2:30pm CT)• June 27 (1:00-2:30pm CT)• The How, What, and Why of Performance Testing YourApplications• May 2 (1:00-2:30pm CT)• Top Business Benefits of Application Lifecycle Management(ALM)• June 3 (1:00-2:00pm CT)• Managing Test Labs Without the Headaches• June 6 (1:00-2:30pm CT)• June 20 (1:00-2:30pm CT)
    26. 26. Free Services from Imaginet & MicrosoftThere are a number of different Microsoft Programs that youmight be able to leverage to get some free services fromImaginet:• Deployment Planning Services (DPS) – You can trade in yourMicrosoft Software Assurance credits to receive some freeTFS/ALM Deployment Planning Services days with Imaginet• Partner Services Credit (PSC) – Have you or are you about tospend money with Microsoft on Visual Studio 2012 products? Ifso, Microsoft may kick in some funding to help you successfullyadopt.• Virtual Technical Specialist (VTS) hours –You may be eligibleto receive some free remote consulting/training hours withImaginet through the Microsoft Virtual Technical Specialistprogram.For more information, email bmadison@imaginet.com.
    27. 27. Need Help with YOUR Automated Testing?• Learn best practices for test selection, extension, databinding, maintenance, frameworks, community extensions(such as the CUITe and the UI Map Toolbox), and otherreal-world scenarios.• Includes automated test development & execution for YOURapplication• Support and training for your team• Includes a high-level ALM assessmentImaginet’s Visual Studio 2012Automated Testing 5-day QuickstartInterested? Just email us at info@imaginet.com.
    28. 28. Email us at:ALM Planning & Implementation ServicesALM Planning• ALM Assessment & Envisioning Workshops(3 or 5 days)• VS & TFS Migration Planning Workshop (5days)• TFS Deployment Planning* (5 days)• Visual SourceSafe to TFS MigrationPlanning* (3 Days)• Visual Studio Quality Tools DeploymentPlanning* (5 days)Upgrade• TFS 2010 Adoption Quick Start (5 or 10days)• TFS 2012 Adoption Quick Start (5 or 10days)• TFS 2010 Upgrade Quick Start (10 days)• TFS 2012 Upgrade Quick Start (10 days)Remote Support• Remote Support for TFS & Visual StudioLab• Visual Studio Lab Management Quick Start(10 days)Testing• Manual Testing with Test Manager QuickStart (5 days)• Visual Studio Testing Tools Quick Start (10days)• Visual Studio Automated Testing Quick Start(5 days)• Visual Studio Load Testing Quick Start (5 or10 Days)Builds• Automated Build & Release ManagementQuick Start (5 days)• Automated Build Center of Excellence (CoE)Database• Visual Studio Database Tools Quick Start(10 days)Integrations• Team Foundation Server (TFS) & ProjectServer Integration Quick Start (10 days)• TFS & Quality Center Integration/MigrationQuick Start (10 days)
    29. 29. For questions or more information,please contact us at:info@imaginet.com or (972)607-4830Remember to add http://blog.imaginet.com to your favorite reader!
    30. 30. http://www.imaginet.com

    ×