Test Driven JavaScript Development (Developer's Library)
معرفی کتاب «Test Driven JavaScript Development (Developer's Library)» نوشتهٔ Johansen, Christian Johansen، منتشرشده توسط نشر Addison-Wesley Professional در سال 2010. این کتاب در 92 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «Test Driven JavaScript Development (Developer's Library)» در دستهٔ بدون دستهبندی قرار دارد.
For JavaScript developers working on increasingly large and complex projects, effective automated testing is crucial to success. Test-Driven JavaScript Development is a complete, best-practice guide to agile JavaScript testing and quality assurance with the test-driven development (TDD) methodology. Leading agile JavaScript developer Christian Johansen covers all aspects of applying state-of-the-art automated testing in JavaScript environments, walking readers through the entire development lifecycle, from project launch to application deployment, and beyond. Using real-life examples driven by unit tests, Johansen shows how to use TDD to gain greater confidence in your code base, so you can fearlessly refactor and build more robust, maintainable, and reliable JavaScript code at lower cost. Throughout, he addresses crucial issues ranging from code design to performance optimization, offering realistic solutions for developers, QA specialists, and testers. Coverage includes • Understanding automated testing and TDD • Building effective automated testing workflows • Testing code for both browsers and servers (using Node.js) • Using TDD to build cleaner APIs, better modularized code, and more robust software • Writing testable code • Using test stubs and mocks to test units in isolation • Continuously improving code through refactoring • Walking through the construction and automated testing of fully functional software The accompanying Web site, tddjs.com, contains all of the book’s code listings and additional resources. Cover......Page 1 Contents......Page 8 Preface......Page 20 Acknowledgments......Page 26 About the Author......Page 28 Part I: Test-Driven Development......Page 30 1. Automated Testing......Page 32 1.1 The Unit Test......Page 33 1.2 Assertions......Page 38 1.3 Test Functions, Cases and Suites......Page 40 1.4 Integration Tests......Page 43 1.5 Benefits of Unit Tests......Page 45 1.7 Summary......Page 47 2.1 Goal and Purpose of Test-Driven Development......Page 50 2.2 The Process......Page 52 2.3 Facilitating Test-Driven Development......Page 58 2.4 Benefits of Test-Driven Development......Page 59 2.5 Summary......Page 60 3.1 xUnit Test Frameworks......Page 62 3.2 In-Browser Test Frameworks......Page 66 3.3 Headless Testing Frameworks......Page 70 3.4 One Test Runner to Rule Them All......Page 71 3.5 Summary......Page 81 4.1 Exploring JavaScript with Unit Tests......Page 84 4.2 Performance Tests......Page 89 4.3 Summary......Page 98 Part II: JavaScript for Programmers......Page 100 5.1 Defining Functions......Page 102 5.2 Calling Functions......Page 106 5.3 Scope and Execution Context......Page 109 5.4 The this Keyword......Page 116 5.5 Summary......Page 120 6.1 Binding Functions......Page 122 6.2 Immediately Called Anonymous Functions......Page 130 6.3 Stateful Functions......Page 136 6.4 Memoization......Page 141 6.5 Summary......Page 144 7.1 Objects and Properties......Page 146 7.2 Creating Objects with Constructors......Page 159 7.3 Pseudo-classical Inheritance......Page 165 7.4 Encapsulation and Information Hiding......Page 174 7.5 Object Composition and Mixins......Page 179 7.6 Summary......Page 187 8.1 The Close Future of JavaScript......Page 188 8.2 Updates to the Object Model......Page 190 8.3 Strict Mode......Page 200 8.4 Various Additions and Improvements......Page 203 8.5 Summary......Page 205 9.1 The Goal of Unobtrusive JavaScript......Page 206 9.2 The Rules of Unobtrusive JavaScript......Page 207 9.3 Do Not Make Assumptions......Page 212 9.4 When Do the Rules Apply?......Page 213 9.5 Unobtrusive Tabbed Panel Example......Page 214 9.6 Summary......Page 225 10. Feature Detection......Page 226 10.1 Browser Sniffing......Page 227 10.2 Using Object Detection for Good......Page 229 10.3 Feature Testing DOM Events......Page 236 10.4 Feature Testing CSS Properties......Page 237 10.5 Cross-Browser Event Handlers......Page 239 10.6 Using Feature Detection......Page 242 10.7 Summary......Page 243 Part III: Real-World Test-Driven Development in JavaScript......Page 246 11. The Observer Pattern......Page 248 11.1 The Observer in JavaScript......Page 249 11.2 Adding Observers......Page 251 11.3 Checking for Observers......Page 255 11.4 Notifying Observers......Page 259 11.5 Error Handling......Page 261 11.6 Observing Arbitrary Objects......Page 264 11.7 Observing Arbitrary Events......Page 270 11.8 Summary......Page 275 12.1 Test Driving a Request API......Page 276 12.2 Implementing the Request Interface......Page 278 12.3 Creating an XMLHttpRequest Object......Page 279 12.4 Making Get Requests......Page 284 12.5 Using the Ajax API......Page 298 12.6 Making POST Requests......Page 306 12.7 Reviewing the Request API......Page 317 12.8 Summary......Page 321 13. Streaming Data with Ajax and Comet......Page 322 13.1 Polling for Data......Page 323 13.2 Comet......Page 343 13.3 Long Polling XMLHttpRequest......Page 344 13.4 The Comet Client......Page 350 13.5 Summary......Page 368 14.1 The Node.js Runtime......Page 370 14.2 The Controller......Page 374 14.3 Domain Model and Storage......Page 387 14.4 Promises......Page 396 14.5 Event Emitters......Page 401 14.6 Returning to the Controller......Page 407 14.7 Summary......Page 416 15.1 Planning the Client......Page 418 15.2 The User Form......Page 421 15.3 Using the Client with the Node.js Backend......Page 437 15.4 The Message List......Page 440 15.5 The Message Form......Page 451 15.6 The Final Chat Client......Page 458 15.7 Summary......Page 463 PartIV: Testing Patterns......Page 466 16.1 An Overview of Test Doubles......Page 468 16.2 Test Verification......Page 470 16.3 Stubs......Page 472 16.4 Test Spies......Page 474 16.5 Using a Stub Library......Page 476 16.6 Mocks......Page 482 16.7 Mocks or Stubs?......Page 486 16.8 Summary......Page 487 17. Writing Good Unit Tests......Page 490 17.1 Improving Readability......Page 491 17.2 Tests as Behavior Specification......Page 497 17.3 Fighting Bugs in Tests......Page 502 17.4 Summary......Page 504 Bibliography......Page 506 A......Page 508 C......Page 510 D......Page 512 E......Page 513 G......Page 514 I......Page 515 L......Page 516 N......Page 517 O......Page 518 P......Page 519 S......Page 521 T......Page 523 U......Page 524 V......Page 525 Z......Page 526 Provides information on effective JavaScript testing with the test-driven development methodology to build APIs and code.
دانلود کتاب Test Driven JavaScript Development (Developer's Library)