Testing the User Interface - Coded UI Tests with Visual Studio 2010


Published on

With the new Coded UI test in Visual Studio 2010, building automated tests for the user interface is no longer the unattainable Nirvana. In this session, we will explore the features of Coded UI tests in VS 2010. We will walk through how you record tests, add assertions and customize the resulting tests for increased automation. Finally, we will explore how to customize existing Coded UI tests and how to run them with your automated builds.

Published in: Technology, Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Testing the User Interface - Coded UI Tests with Visual Studio 2010

  1. 1. Testing the User Interface<br />Coded UI Tests with Visual Studio 2010<br />Eric D. Boyd<br />
  2. 2. Introduction<br />Eric D. Boyd<br />15 years in technology<br />
  3. 3. I’m From Here<br />
  4. 4. I Moved Here<br />
  5. 5. I Work Here<br />www.centare.com<br />
  6. 6. I Work On<br />
  7. 7. I Blog Here<br />www.ericdboyd.com<br />
  8. 8. I Tweet Here<br />www.twitter.com/EricDBoyd<br />
  9. 9. Getting to Know You<br />Photo by www.rebeccasandulak.com/<br />
  10. 10. Agenda<br />The State of Software Testing<br />Manual Testing<br />Coded UI Tests<br />Coded UI Best Practices<br />What’s New Since RTM?<br />Q&A<br />
  11. 11. Northeast Blackout of 2003<br />10 million people in Ontario and 45 million people in eight US states were without power<br />Race condition in GE Energy’s Unix-based XA/21 energy management system<br />Stalled FirstEnergy’s control room alarm system for over an hour<br />Hid audio and visual alerts of system state changes, unprocessed events queued, and the primary server failed within 30 minutes<br />Toronto on the evening of August 14<br />http://en.wikipedia.org/wiki/Northeast_Blackout_of_2003<br />
  12. 12. Therac-25<br />Patients were given massive overdoses of radiation, 100 times the intended dose<br />3 patients died from radiation poisoning<br />Race conditions occurred when the operator changed the setup quickly<br />Arithmetic overflow caused the software to bypass safety checks<br />http://en.wikipedia.org/wiki/Therac-25<br />
  13. 13. Ariane 5, Maiden Voyage<br />June 4, 1996, rocket explodes 39 seconds after take-off<br />Decade of development and $7 billion dollars invested<br />Destroyed rocket and cargo valued at $500 million<br />64-bit float converted to 16-bit signed integer, larger than 32,767, failed<br />http://en.wikipedia.org/wiki/Ariane_5_Flight_501<br />
  14. 14. Software Quality Troubles<br />“my testers are spending too long testing the same thing”<br />“tooling is expensive (time, licenses, people)”<br />“when is my software ready to ship?”<br />“developers and testers work in silos and don’t communicate/speak the same language”<br />“it will take weeks for regression testing”<br />
  15. 15. What the Industry Says<br />software bugs cost the US economy an estimated $59.5 billion every year<br />last year, canceled projects cost firms $67 billion; overruns on the other projects racked up another $21billion<br />on average professional coders make 100 to 150 errors in every 1000 lines of code they write<br />
  16. 16. What If You Could…<br />easily manage test plans and test cases<br />enable developers to easily automate functional UI tests<br />Integrate functional UI testing into build automation<br />parameterize playback of recorded tests<br />fast forward through manual testing<br />
  17. 17. Areas of the Project Lifecycle<br />
  18. 18. Story Time – Testing Failures<br />
  19. 19. Testing Cycle<br />
  20. 20. Tester Life<br />70% of testing happens here<br />Majority of test tools target here<br />Black Box Testing<br />White Box Testing<br />API Testing<br />
  21. 21. Visual Studio 2010<br />Generalist<br />Specialist<br />Coded UI Test<br />Unit Testing<br />Web Test<br />Test Runner<br />Load Test<br />FF Manual Test<br />Test Case Management<br />Virtual Lab Management<br />Data Collectors (Intellitrace, System Info.) <br />Team Foundation Server with Reporting<br />
  22. 22. Challenges of UI Testing<br />
  23. 23. What are Coded UI Tests?<br />
  24. 24. Anatomy of Coded UI Tests<br />
  25. 25. Demo – Create Coded UI Tests <br />
  26. 26. Demo – Manual Testing<br />
  27. 27. Demo – Automating the Manual Tests<br />
  28. 28. Demo – Editing Existing Coded UI Test<br />
  29. 29. Demo – Customizing Tests<br />
  30. 30. Demo – Data-Driven Coded UI Tests<br />
  31. 31. Coded UI Best Practices<br />Use the Coded UI Test Builder<br />DO NOT EVER edit the UIMap.designer.cs file<br />Use meaningful names<br />Use meaningful Assertions<br />Limit the number of actions<br />Re-record when the UI changes<br />Create separate UIMap files for each module<br />API Coding<br />Use the generated classes as much as possible<br />Create a method for each custom assertion in UIMap.cs<br />
  32. 32. Feature Pack 2<br />
  33. 33. Demo – Feature Pack 2<br />
  34. 34. Automation Platform Support<br />
  35. 35. Demo – Build Automation<br />
  36. 36. UITestArchitecture<br />Write a client that does something else!<br />My UI<br />Coded UI Test<br />Test Runner<br />Interpreter<br />Code Generation<br />Action Invoker<br />Custom properties & code<br />Customize recording<br />Add/Modify API<br />Playback<br />Recorder<br />Filter/ Aggregation Rules<br />API<br />Property Provider<br />Browser Service<br />Add another browser<br />Technology Abstraction Layer<br />Write technology adapters<br />Web Plug-ins<br />(MSHTML/DOM)<br />Rich Client Plug-ins<br />(UIA/MSAA)<br />3rd Party Plug-ins<br />
  37. 37. Coded UI is Only One of the Tools<br />Test Case Management<br />1000 vUsers<br />Web Test<br />Load Test<br />Manual Testing<br />Fast Fwd for Manual Testing<br />Rich Actionable Bugs<br />Virtual Env. Setup/Tear Down<br />Environment from Template<br />Checkpoint Environment<br />Team Explorer<br />Agents<br />*Requires Visual Studio Test Professional 2010 for virtual lab management & configuration.<br />
  38. 38. Improving Quality with VS 2010<br />Better Tools for Manual Testing<br />UI Test Automation<br />Tester-Developer Collaboration<br />Build Integration<br />
  39. 39. How to Get Started<br />Visual Studio 2010 Premium or Ultimate<br />Test Professional (optional)<br />Team Foundation Server (optional)<br />Play for FREE with VS 2010 and TFS 2010 VHD<br />Windows Virtual PC (Windows 7)<br />Microsoft Virtual PC 2007 SP 1<br />Windows Server 2008 Hyper-V<br />
  40. 40. Useful Resources<br />VS 2010 Testing<br />http://msdn.microsoft.com/en-us/library/ms182409.aspx<br />VS 2010 Coded UI<br />http://msdn.microsoft.com/en-us/library/dd286726.aspx<br />VS 2010 Main Resource Page<br />http://msdn.microsoft.com/en-us/library/dd831853.aspx<br />Local Technology Events<br />http://twitter.com/MWD_DevEvents<br />
  41. 41. Q&A<br />
  42. 42. Thank You!<br />