Test First User Interfaces
Total Page:16
File Type:pdf, Size:1020Kb
This censored preview contains these irritations: • the best case studies are chopped out – the tutorial ones, and the ones that push the boundaries of games, data entry, linguistics, and the Web • a number of TODO comments contain instructions for typography (meaning things I could not figure out how to tell WinWord to do), and internal TODOs reminding me to polish some detail The good news is: • the introductory chapters, which read like the best of my online writings, but with all the camp stylings replaced by IMHO erudition • the Fractal Life Engine chapter. This pretends to push TDD into 3d graphics, but you will notice it does not. It contains both technical themes and team themes that apply to any project, but careful reading reveals it doesn’t _really_ TDD 3d graphics. The Cheshire Cat fades away, leaving only her smile… Phlip Page i 10/8/2005 Dedicated to Ashley & Iris (like I had a choice ;-) Phlip Page ii 10/8/2005 Cover design by TODO The cover features Angkor Wat, the largest temple in the remains of the capital of the Khmer civilization. Built from 879 to 1191 CE in Cambodia. Phlip Page iii 10/8/2005 Contents TODO: stack the Header 3 citations Contents....................................................................................................................iv Forward.................................................................................................................. viii Acknowledgements.................................................................................................. ix Introduction...................................................................................................................1 Who Should Read this Book..................................................................................... 2 Developers.......................................................................................................................................2 Students........................................................................................................................................... 3 Testers............................................................................................................................................. 3 Usability Experts............................................................................................................................. 4 Leaders............................................................................................................................................ 4 Style...........................................................................................................................4 Part I: One Button Testing............................................................................................ 6 Chapter 1: The GUI Problem........................................................................................7 What is Test-First Programming?............................................................................. 7 What’s a Test Case?........................................................................................................................ 8 How Do Tests Make Development Faster?.....................................................................................8 Can Tests Catch Every Bug?...........................................................................................................9 What’s the Best Way to Fix a Failing Test?....................................................................................9 Why 1 to 10 Edits?..........................................................................................................................9 Why Test FIRST?........................................................................................................................... 9 How Do Tests Sustain Development?...........................................................................................10 What’s So Special about GUIs?.............................................................................. 11 Why is TFP for GUIs Naturally Hard?......................................................................................... 11 Why is TFP for GUIs Artificially Hard?.......................................................................................11 How to Avoid TDDing a GUI?.....................................................................................................12 So Why Bother TDDing a GUI?............................................................................. 14 Authoring...................................................................................................................................... 14 But Aren’t All GUIs Different?...............................................................................14 Conclusion...............................................................................................................15 Chapter 2: The TFUI Principles..................................................................................16 How to Test-Infect a GUI?......................................................................................16 One Button Testing................................................................................................. 17 Just Another Library................................................................................................17 Regulate the Event Queue....................................................................................... 18 Temporary Visual Inspections...................................................................................................... 18 Temporary Interactive Tests..........................................................................................................18 Broadband Feedback.....................................................................................................................18 Query Visual Appearance........................................................................................18 Simulate User Input.................................................................................................19 Loose User Simulations.................................................................................................................19 Firm User Simulations...................................................................................................................19 Strict User Simulations..................................................................................................................19 Fault Navigation......................................................................................................24 Flow.........................................................................................................................24 Conclusion...............................................................................................................24 Phlip Page iv 10/8/2005 Chapter 3: GUI Architecture.......................................................................................26 An Ideal Layering....................................................................................................27 Output............................................................................................................................................27 Input.............................................................................................................................................. 29 The Event Queue...........................................................................................................................30 Best of Both Worlds................................................................................................31 To Test Controls…........................................................................................................................32 To Test Scripts….......................................................................................................................... 32 To Test Paint() Events…...............................................................................................................32 Mock Graphics.............................................................................................................................. 33 Hyperactive Tests.................................................................................................... 34 Fuzzy Logic...................................................................................................................................34 Acolyte Checks Output................................................................................................................. 36 Programming vs. Authoring.......................................................................................................... 37 Fuzzy Matches...............................................................................................................................38 Regular Expression Matches ........................................................................................................ 38 Parsed Fuzzy Matches...................................................................................................................39 Conclusion...............................................................................................................40 Chapter 4: The Development Lifecycle with GUIs.................................................... 41 When to Design the GUI........................................................................................