Table of Contents for
Testable JavaScript
Close
Version ebook
/
Retour
Testable JavaScript
by Mark Ethan Trostler
Published by O'Reilly Media, Inc., 2013
Cover
Testable JavaScript
Testable JavaScript
Dedication
Preface
1. Testable JavaScript
2. Complexity
3. Event-Based Architectures
4. Unit Tests
5. Code Coverage
6. Integration, Performance, and Load Testing
7. Debugging
8. Automation
Index
About the Author
Colophon
Copyright
Testable JavaScript
Table of Contents
Dedication
Preface
The Goal of This Book
Who This Book Is For
Who This Book Is Not For
Who I Am
What You Will Learn from This Book
Content
If You Like (or Don’t Like) This Book
Recap
How to Contact Us
Conventions Used in This Book
Using Code Examples
Safari® Books Online
Thanks!
1. Testable JavaScript
Prior Art
Agile Development
Test-Driven Development
Behavior-Driven Development
The Best Approach?
Code Is for People
Why
Why testable
Why maintainable
Why understandable
What
What is testable
What is maintainable
What is understandable
How
How testable
How maintainable
How understandable
Beyond Application Code
Testing
Debugging
Recap
2. Complexity
Code Size
JSLint
Cyclomatic Complexity
Reuse
Fan-Out
Fan-In
Coupling
Content Coupling
Common Coupling
Control Coupling
Stamp Coupling
Data Coupling
No Coupling
Instantiation
Coupling Metrics
Coupling in the Real World
Testing Coupled Code
Dependency Injection
Comments
YUIDoc
JSDoc
Docco/Rocco
The Human Test
Recap
3. Event-Based Architectures
The Benefits of Event-Based Programming
The Event Hub
Using the Event Hub
Responses to Thrown Events
Event-Based Architectures and MVC Approaches
Event-Based Architectures and Object-Oriented Programming
Event-Based Architectures and Software as a Service
Web-Based Applications
Testing Event-Based Architectures
Caveats to Event-Based Architectures
Scalability
Broadcasting
Runtime Checking
Security
State
A Smarter Hub: The Event Switch
Deployment
Unicast events
Broadcast events
An Implementation
Sessions
Extensibility
Recap
4. Unit Tests
A Framework
Let’s Get Clean
Writing Good Tests
Isolation
Scope
Defining Your Functions
Comment blocks
Tests
Positive Testing
Negative Testing
Code Coverage
Real-World Testing
Dependencies
Doubles
Mock objects
Stubs
Spies
Asynchronous Testing
Using YUI Test
Running Tests: Client-Side JavaScript
PhantomJS
Selenium
Mobile
iOS
Android
Running Tests: Server-Side JavaScript
Jasmine
Dependencies
Spies
Output
Recap
5. Code Coverage
Coverage Basics
Code Coverage Data
A Hands-on Example
Instrumenting Files
Anatomy of a Coveraged File
Exercise/Deploy
Client-Side JavaScript
Server-Side JavaScript
Persisting Coverage Information
Unit Tests
Integration Tests
Generating Output
Aggregation
Hidden Files
Coverage Goals
Recap
6. Integration, Performance, and Load Testing
Integration Testing
Selenium
WebDriver
Remote Control
Grid
CasperJS
Performance Testing
Generating HAR Files
Using a proxy
Viewing HAR Files
Browser Performance Testing
Load Testing
Browser Load Testing
Tracking Resource Usage
Client-Side Tracking
Memory usage
CPU usage
Server-Side Tracking
Programmatic heap snapshots
Programmatic CPU usage
Recap
7. Debugging
In-Browser Debugging
Firefox
Chrome
Safari
Internet Explorer
Node.js Debugging
Remote Debugging
Chrome
PhantomJS
Firefox
Mobile Debugging
Android 4
iOS 6
Adobe Edge Inspect
Other Mobile Debugging Options
Production Debugging
Minified Code
Source Maps
Recap
8. Automation
What to Automate
When to Automate
How to Automate
Automating with Continuous Integration
Automating the Development Environment
The editor
Unit tests
Code reviews
Commit hooks
Other development tools
Automating the Build Environment
The build
Jenkins
Creating a Jenkins project
Unit testing using Selenium
Unit test output
Coverage output
Complexity
JSLint
Duplicate code
Other analysis
Notification
Dependent builds
The Full Monty
Non-UI usage
Deployment
Recap
Index
About the Author
Colophon
Copyright