Backbone.js testing : plan, architect, and develop tests for Backbone.js applications using modern testing principles and practices /
This book is packed with the step by step tutorial and instructions in recipe format helping you setup test infrastructure and gradually advance your skills to plan, develop, and test your backbone applications. If you are a JavaScript developer looking for recipes to create and implement test suppo...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Pub.,
2013.
|
Colección: | Community experience distilled.
|
Temas: | |
Acceso en línea: | Texto completo |
Tabla de Contenidos:
- Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1:Setting Up a Test Infrastructure; Designing an application and test repository structure; Getting the test libraries; Mocha; Chai; Sinon. JS; Setting up and writing our first tests; The test driver page; Adding some tests; Running and assessing test results; The first test report; Test report actions; Test timing and slow tests; Test failures; Summary; Chapter 2:Creating a Backbone.js Application Test Plan; A Backbone.js refresher.
- Selecting a Backbone.js application to testGetting acquainted with the Notes application; Anatomy of the Notes application; Test paradigms and methods; Testing concepts, approaches, and planning; Testing individual Backbone.js components; Models; Collections; Templates; Views; Routers; Utilities; Testing application interactions and events; Partial integrations; Events; Dipping our toes in the application testing waters; Namespace; Note model; Running the application tests; Summary; Chapter 3:Test Assertions, Specs, and Suites; Choosing a test style that fits; Mocha test interfaces.
- Chai assertion stylesTrying out some different styles; Mocha and Chai BDD interfaces; Mocha TDD and Chai assert styles; Deciding on the project style; A tour of the Chai assertion library; Chaining objects and assertions; Basic value assertions; Comparing values; Object and array validation; Errors; Getting the application and tests ready to run; The Mocha test runner; Reconfiguring the application for testing; Organizing topics and specifications into test suites; Starting up and winding down tests; Writing Mocha test specifications; Asynchronous behavior in tests.
- Some Backbone.js collection testsTesting and supporting Backbone.js views; The Notes application single note view; Creating HTML fixtures for view tests; Walking through the view test suite; Aggregating and running the application tests; Test development tips, tricks, and hints; Isolating and excluding tests; Writing testable application code; Summary; Chapter 4:Test Spies; Fake it 'til you make it; Getting to know Sinon. JS; Spying on functions with Sinon. JS; Anonymous spies; Spy assertions; Function spies; Object method spies; Playing in the sandbox with Sinon. JS test helpers.
- Delving into the Sinon. JS spy APIThe spy API; The spy call API; Spicing up Chai with the Sinon. JS plugin; Introducing and installing Chai plugins; The Sinon. JS plugin; Testing Backbone.js components with spies; The Notes menu bar view; The menu bar view; Testing and spying on the menu bar view; The Notes single note view; The single note view; Testing the single note view; Hooking up and running the view tests; Summary; Chapter 5:Test Stubs and Mocks; Replacing method behaviors with Sinon. JS stubs; Getting started with stubs; The stub API; Faking and verifying behavior with Sinon. JS mocks.