1 option
Test-driven JavaScript development
- Format:
- Book
- Author/Creator:
- Johansen, Christian, Author.
- Series:
- Developer's library series Test-driven JavaScript development
- Language:
- English
- Subjects (All):
- JavaScript (Computer program language).
- Physical Description:
- 1 online resource (xxvii, 497 p.) : ill.
- Edition:
- 1st edition
- Other Title:
- Developer's library series
- Place of Publication:
- [Place of publication not identified] Addison Wesley 2011
- Language Note:
- English
- System Details:
- text file
- Summary:
- 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.
- Contents:
- Cover
- Contents
- Preface
- Acknowledgments
- About the Author
- Part I: Test-Driven Development
- 1. Automated Testing
- 1.1 The Unit Test
- 1.2 Assertions
- 1.3 Test Functions, Cases and Suites
- 1.4 Integration Tests
- 1.5 Benefits of Unit Tests
- 1.6 Pitfalls of Unit Testing
- 1.7 Summary
- 2. The Test-Driven Development Process
- 2.1 Goal and Purpose of Test-Driven Development
- 2.2 The Process
- 2.3 Facilitating Test-Driven Development
- 2.4 Benefits of Test-Driven Development
- 2.5 Summary
- 3. Tools of the Trade
- 3.1 xUnit Test Frameworks
- 3.2 In-Browser Test Frameworks
- 3.3 Headless Testing Frameworks
- 3.4 One Test Runner to Rule Them All
- 3.5 Summary
- 4. Test to Learn
- 4.1 Exploring JavaScript with Unit Tests
- 4.2 Performance Tests
- 4.3 Summary
- Part II: JavaScript for Programmers
- 5. Functions
- 5.1 Defining Functions
- 5.2 Calling Functions
- 5.3 Scope and Execution Context
- 5.4 The this Keyword
- 5.5 Summary
- 6. Applied Functions and Closures
- 6.1 Binding Functions
- 6.2 Immediately Called Anonymous Functions
- 6.3 Stateful Functions
- 6.4 Memoization
- 6.5 Summary
- 7. Objects and Prototypal Inheritance
- 7.1 Objects and Properties
- 7.2 Creating Objects with Constructors
- 7.3 Pseudo-classical Inheritance
- 7.4 Encapsulation and Information Hiding
- 7.5 Object Composition and Mixins
- 7.6 Summary
- 8. ECMAScript 5th Edition
- 8.1 The Close Future of JavaScript
- 8.2 Updates to the Object Model
- 8.3 Strict Mode
- 8.4 Various Additions and Improvements
- 8.5 Summary
- 9. Unobtrusive JavaScript
- 9.1 The Goal of Unobtrusive JavaScript
- 9.2 The Rules of Unobtrusive JavaScript
- 9.3 Do Not Make Assumptions
- 9.4 When Do the Rules Apply?
- 9.5 Unobtrusive Tabbed Panel Example
- 9.6 Summary
- 10. Feature Detection
- 10.1 Browser Sniffing.
- 10.2 Using Object Detection for Good
- 10.3 Feature Testing DOM Events
- 10.4 Feature Testing CSS Properties
- 10.5 Cross-Browser Event Handlers
- 10.6 Using Feature Detection
- 10.7 Summary
- Part III: Real-World Test-Driven Development in JavaScript
- 11. The Observer Pattern
- 11.1 The Observer in JavaScript
- 11.2 Adding Observers
- 11.3 Checking for Observers
- 11.4 Notifying Observers
- 11.5 Error Handling
- 11.6 Observing Arbitrary Objects
- 11.7 Observing Arbitrary Events
- 11.8 Summary
- 12. Abstracting Browser Differences: Ajax
- 12.1 Test Driving a Request API
- 12.2 Implementing the Request Interface
- 12.3 Creating an XMLHttpRequest Object
- 12.4 Making Get Requests
- 12.5 Using the Ajax API
- 12.6 Making POST Requests
- 12.7 Reviewing the Request API
- 12.8 Summary
- 13. Streaming Data with Ajax and Comet
- 13.1 Polling for Data
- 13.2 Comet
- 13.3 Long Polling XMLHttpRequest
- 13.4 The Comet Client
- 13.5 Summary
- 14. Server-Side JavaScript with Node.js
- 14.1 The Node.js Runtime
- 14.2 The Controller
- 14.3 Domain Model and Storage
- 14.4 Promises
- 14.5 Event Emitters
- 14.6 Returning to the Controller
- 14.7 Summary
- 15. TDD and DOM Manipulation: The Chat Client
- 15.1 Planning the Client
- 15.2 The User Form
- 15.3 Using the Client with the Node.js Backend
- 15.4 The Message List
- 15.5 The Message Form
- 15.6 The Final Chat Client
- 15.7 Summary
- PartIV: Testing Patterns
- 16. Mocking and Stubbing
- 16.1 An Overview of Test Doubles
- 16.2 Test Verification
- 16.3 Stubs
- 16.4 Test Spies
- 16.5 Using a Stub Library
- 16.6 Mocks
- 16.7 Mocks or Stubs?
- 16.8 Summary
- 17. Writing Good Unit Tests
- 17.1 Improving Readability
- 17.2 Tests as Behavior Specification
- 17.3 Fighting Bugs in Tests
- 17.4 Summary
- Bibliography
- Index
- A
- B
- C
- D
- E
- F
- G
- H.
- I
- J
- L
- M
- N
- O
- P
- Q
- R
- S
- T
- U
- V
- W
- X
- Y
- Z.
- Notes:
- Bibliographic Level Mode of Issuance: Monograph
- Includes bibliographical references and index.
- Description based on publisher supplied metadata and other sources.
- ISBN:
- 9786612768088
- 9781282768086
- 1282768085
- 9780321684042
- 0321684044
- OCLC:
- 1027199360
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.