Functional & Automated Testing Randy Pagels, Technical Specialist Microsoft Corporation Continuous Value Delivery Define Ideation • • REQUIREMENTS PowerPoint Storyboarding Agile Planning Tools Measure Actionable learning • Continuous Integration Operate Develop Idea to working software • • • • • • • Suspend & Resume Code Reviews Feedback Collection Unit Testing Exploratory Testing Continuous Integrations Continuous Deployments Deployment to feedback Sprint Monitor • • • SCOM Integration IntelliTrace in Production PreEmptive Analytics Architect Architectural Discovery WORKING SOFTWARE • • • Understand the Domain Understand Code Complexity Maintain Control Manual testing User Interface Services Business Processes Business Rules and Logic Service integrations Data access Identity Data Automated testing Automated testing Business challenges Solutions Business value Record and automate UI tests UI regression test needs grow over time Manual UI testing impacts the delivery cycle times Automated UI tests are brittle, time-consuming to maintain Robustly instrument UI tests to reduce maintenance overhead Test more functionality in less time Associate UI tests with a scheduled build Reduce or eliminate repetitive manual testing Reduce cycle time when delivering new features Convert the test case to code for enhanced flexibility Generate your Coded UI test from an existing recording, or record a new test case on the fly Cross-browser testing support allows automated testing on multiple browsers CodedUI tests interact directly with your app’s UI Tests can be run and monitored on the local machine, or further automated on a virtual machine Coded UI tests run as part of your unit testing suite, enabling developers to detect defects early Coded UI tests are part of source control for maximum visibility Even if the look & feel changes, the automated test still executes properly Import and run Squish GUI tests directly in Visual Studio and view results Preferred partner solution : FrogLogic Associate Squish tests with MTM Test Cases Push Squish tests into TFS Keyword-driven authoring platform using familiar tools Preferred partner solution : LogiGear Library of preprogrammed reusable actions Fully integrated, multiplatform testing Use unit and web tests to run points of presence health checks in production Detect service/application health anomalies before your users do • Import unit and web tests created during development into GSM (Global service monitoring) • Configure and run points of presence health checks using imported unit and web tests • Get proactively notified of service/application health anomalies to mitigate poor user experiences MTTR reduction with integrated incident management Incident management tools and workflows to integrate operations and development teams in reducing MTTR Reduction of MTTR • SCOM and TFS integrated workflows to manage incidents from occurrence to resolution • One click “Assign to Engineering” from SCOM • Collection of actionable diagnostics in production for development troubleshooting (IntelliTrace) Visit Team System Café Today! The door is open 24/7 at the café! Stop by for a cup of joe and delicious tidbits on AppDev topics! Now available in Windows Store, TSC Companion! Coded UI Best Practices Use the Coded UI Test Builder whenever possible Do not modify UIMap.designer.cs as it may be overwritten Create your test as a sequence of methods Create a new test method for each new page, form, or dialog When you create a method, use a meaningful name Try to limit each method to fewer than 10 actions Create each assertion using the Coded UI Test Builder If the UI changes, re-record the test or assertion methods Know Your Playback.PlaybackSettings ContinueOnError DelayBetweenActions MatchExactHierarchy SearchTimeOut SmartMatchOptions TopLevelWindow Control None ThinkTimeMultiplier WaitForReadyTimeout Wait For It… WaitForControlReady WaitForControlEnabled WaitForControlExist WaitForControlNotExist WaitForControlPropertyEqual WaitForControlPropertyNotEqual WaitForControlCondition Get Used to using. It’s Useful! var path = this.UIMap.LaunchAppParams.UIMyWindowsFormsAppWindowExePath; var altPath = this.UIMap.LaunchAppParams.UIMyWindowsFormsAppWindowAlternateExePath; using (ApplicationUnderTest.Launch(path, altPath)) { this.UIMap.SimpleTest(); … } Searching & Filtering Searching used to look for all possible controls Filtering used to narrow that list exactly one match X, Y only used to guide where the clicks happen within a control Mouse.Click(uIGOButton, new Point(19, 18)); Databinding Test -> Windows -> Test View -> Properties Select CSV, XML, or SQL this.UIMap.SimpleTestParams.UIMyTextboxEditText = TestContext.DataRow[“col_name"].ToString(); Databinding to test parameters happens automatically when converting from manual test cases Friendlier Assertions Make it easier to analyze test run issues Assert.AreEqual(expected, actual, “Tax is incorrectly calculated”); Capturing Images Image pic = this.<top_level_window>.CaptureImage(); //Or for entire desktop: Image pic = UITestControl.Desktop.CaptureImage(); pic.Save(@"c:\file.bmp"); TestContext.AddResultFile(@"c:\file.bmp"); Microsoft Test Manager Mark each step as pass/fail when recording manual tests Carefully consider which test cases make sense for automation, and when Use the Automation Status field of test cases to identify candidates for automation