Book Image

Backbone.js Testing

By : Ryan Glenn Roemer
Book Image

Backbone.js Testing

By: Ryan Glenn Roemer

Overview of this book

Table of Contents (13 chapters)
Backbone.js Testing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Index

A

  • acceptance tests
    • about / Testing concepts, approaches, and planning
  • advanced HTML fixtures / Creating HTML fixtures for view tests
  • after() function / Mocha and Chai BDD interfaces
  • after function / Playing in the sandbox with Sinon.JS test helpers
  • anonymous spies
    • about / Anonymous spies
  • App.Views.NoteNav view
    • about / The Notes menu bar view
  • App.Views.NotesItem view / The list item view
  • application
    • designing / Designing an application and test repository structure
    • reconfiguring, for testing / Reconfiguring the application for testing
  • application components
    • test code, organizing into / Organizing topics and specifications into test suites
  • application interactions
    • testing / Testing application interactions and events
  • application testing
    • about / Dipping our toes in the application testing waters
    • namespace / Namespace
    • Note model / Note model
  • application tests
    • running / Running the application tests, Aggregating and running the application tests
    • aggregating / Aggregating and running the application tests
  • array validation, Chai / Object and array validation
  • assertion library, Chai / A tour of the Chai assertion library
  • assertions
    • chaining / Chaining objects and assertions
  • assertion styles, Chai
    • BDD style / Chai assertion styles
    • assert style / Chai assertion styles
  • assert style / Chai assertion styles
  • asynchronous behavior, in tests / Asynchronous behavior in tests

B

  • Backbone.Collection class
    • about / A Backbone.js refresher
  • Backbone.Events module
    • about / A Backbone.js refresher
  • Backbone.js
    • about / A Backbone.js refresher
    • core library components / A Backbone.js refresher, Testing individual Backbone.js components
    • URL, for documentation / A Backbone.js refresher
    • online and print resources / A Backbone.js refresher
    • collection tests / Some Backbone.js collection tests
  • Backbone.js application
    • selecting, for test / Selecting a Backbone.js application to test
    • remote backend, faking / Faking the remote backend in a Backbone.js application
  • Backbone.js components
    • testing, with spies / Testing Backbone.js components with spies
  • Backbone.js tests
    • running, with PhantomJS / Running Backbone.js tests with PhantomJS
  • Backbone.localStorage
    • about / The anatomy of the Notes application
  • Backbone.Model class
    • about / A Backbone.js refresher
  • Backbone.Router
    • about / A Backbone.js refresher
  • Backbone.View object
    • about / A Backbone.js refresher
  • BDD style / Chai assertion styles
  • before() function / Mocha and Chai BDD interfaces
  • beforeEach() function / Mocha and Chai BDD interfaces
  • before function / Playing in the sandbox with Sinon.JS test helpers
  • behavior
    • verifying, with mocks / Faking and verifying behavior with Sinon.JS mocks, Deciding when to mock
    • facking, with mocks / Faking and verifying behavior with Sinon.JS mocks, Deciding when to mock
  • Behavior-Driven Development (BDD) / Chai
    • about / Test paradigms and methods, Mocha test interfaces
  • Blanket.js
    • about / Parting thoughts, next steps, and future ideas
  • Bootstrap
    • about / The anatomy of the Notes application
  • browser environments
    • automating / Automating browser environments

C

  • Chai
    • about / Getting the test libraries, Chai
    • URL / Chai, Parting thoughts, next steps, and future ideas
    • assertion styles / Chai assertion styles
    • BDD interface / Mocha and Chai BDD interfaces
    • TDD interface / Mocha TDD and Chai assert styles
    • language chain objects / Chaining objects and assertions
    • value assertions / Basic value assertions
    • comparison functions / Comparing values
    • object and array validation / Object and array validation
    • program exceptions, verifying / Errors
  • Chai assertion library
    • about / A tour of the Chai assertion library
    • objects, chaining / Chaining objects and assertions
    • assertions, chaining / Chaining objects and assertions
  • Chai assertion styles
    • BDD style / Chai assertion styles
    • assert style / Chai assertion styles
  • Chai assert style
    • about / Mocha TDD and Chai assert styles
  • Chai BDD interface
    • about / Mocha and Chai BDD interfaces
  • Chai plugins
    • about / Introducing and installing Chai plugins
    • installing / Introducing and installing Chai plugins
  • code samples
    • tests, automating / Automating tests in the code samples
  • collections
    • about / A Backbone.js refresher, Collections
  • collection tests, Backbone.js / Some Backbone.js collection tests
  • command line tests
    • about / Automating tests in the code samples
  • comparison functions, Chai
    • equal / Comparing values
    • eql / Comparing values
    • above / Comparing values
    • least / Comparing values
    • below / Comparing values
    • most / Comparing values
    • within / Comparing values
    • closeTo / Comparing values
    • match / Comparing values
    • string / Comparing values
    • satisfy / Comparing values
  • continuous deployment server / Continuous deployment
  • continuous integration server
    • about / Automating tests in the code samples
  • core library components, Backbone.js
    • events / A Backbone.js refresher
    • models / A Backbone.js refresher, Models
    • collections / A Backbone.js refresher, Collections
    • templates / A Backbone.js refresher, Templates
    • views / A Backbone.js refresher, Views
    • routers / A Backbone.js refresher, Routers
    • testing / Testing individual Backbone.js components
    • utilities / Utilities
    • testing, with stubs / Testing Backbone.js components with stubs and mocks, Ensuring stubs and mocks are actually bound
    • testing, with mocks / Testing Backbone.js components with stubs and mocks, Ensuring stubs and mocks are actually bound
  • cross-browser testing
    • about / Other scenarios

D

  • describe() function / Mocha and Chai BDD interfaces

E

  • events
    • about / A Backbone.js refresher, Events
  • expect assertion / Deciding on the project style
  • expectation.atLeast(num) method / The mock API
  • expectation.atMost(num) method / The mock API
  • expectation.exactly(num) method / The mock API
  • expectation.never() method / The mock API
  • expectation.on(obj) method / The mock API
  • expectation.once() method / The mock API
  • expectation.thrice() method / The mock API
  • expectation.twice() method / The mock API
  • expectation.verify() method / The mock API
  • expectation.withArgs(arg1, arg2, ...) method / The mock API
  • expectation.withExactArgs(arg1, arg2, ...) method / The mock API
  • exports interface
    • about / Mocha test interfaces

F

  • fake server API
    • about / The fake server API
  • fake servers
    • about / Fake servers
  • fake timers
    • about / Fake timers
  • fetch() method / Asynchronous behavior in tests
  • full integration tests
    • about / Testing concepts, approaches, and planning
  • functional units, Mocha BDD interface
    • before() / Mocha and Chai BDD interfaces
    • after() / Mocha and Chai BDD interfaces
    • describe() / Mocha and Chai BDD interfaces
    • it() / Mocha and Chai BDD interfaces
  • functional units, Mocha TDD interface
    • suiteSetup() / Mocha TDD and Chai assert styles
    • setup() / Mocha TDD and Chai assert styles
    • suiteTeardown() / Mocha TDD and Chai assert styles
    • teardown() / Mocha TDD and Chai assert styles
    • suite() / Mocha TDD and Chai assert styles
    • test() / Mocha TDD and Chai assert styles
  • function spies
    • about / Function spies

G

  • GitHub
    • about / Continuous integration
  • grep feature / Test report actions
  • guards
    • about / Other scenarios

H

  • headless testing, PhantomJS / Headless testing with PhantomJS
  • headless web browsers / Headless web browsers
  • hosted test automation providers
    • about / Remote controlled web browsers
  • HTML fixtures
    • creating, for view tests / Creating HTML fixtures for view tests

I

  • installation, Chai plugins / Introducing and installing Chai plugins
  • installation, PhantomJS / Installing PhantomJS and the supporting tools
  • it() function / Mocha and Chai BDD interfaces

J

  • Jasmine
    • about / Mocha
  • Jenkins
    • about / Continuous integration
    • URL / Continuous integration
  • JSDom
    • about / Simulated browser environments
    • URL / Simulated browser environments
  • JSHint
    • about / Parting thoughts, next steps, and future ideas

K

  • Karma
    • URL / Multiple environment aggregators

L

  • language chain objects, Chai
    • about / Chaining objects and assertions
    • not / Chaining objects and assertions
    • deep / Chaining objects and assertions
  • list item view
    • about / The list item view
    • testing / Testing the list item view
  • Local Application
    • about / Selecting a Backbone.js application to test

M

  • menu bar view
    • about / The menu bar view
    • testing / Testing and spying on the menu bar view
    • spying / Testing and spying on the menu bar view
  • method behaviors
    • replacing, with Sinon.JS stubs / Replacing method behaviors with Sinon.JS stubs
  • Mocha
    • about / Getting the test libraries, Mocha
    • need for / Mocha
    • test interfaces / Mocha test interfaces
    • BDD interface / Mocha and Chai BDD interfaces
    • TDD interface / Mocha TDD and Chai assert styles
    • URL / Parting thoughts, next steps, and future ideas
  • Mocha BDD interface
    • about / Mocha and Chai BDD interfaces
    • functional units / Mocha and Chai BDD interfaces
  • Mocha TDD interface
    • about / Mocha TDD and Chai assert styles
  • Mocha test interfaces
    • Behavior-Driven Development (BDD) / Mocha test interfaces
    • Test-Driven Development (TDD) / Mocha test interfaces
    • exports / Mocha test interfaces
    • QUnit-styled / Mocha test interfaces
  • Mocha test runner
    • about / The Mocha test runner
  • Mocha test specifications
    • writing / Writing Mocha test specifications
  • mock.expects(methodName) method / The mock API
  • mock.restore() method / The mock API
  • mock.verify() method / The mock API
  • mock API
    • about / The mock API
  • mocks
    • about / Sinon.JS, Fake it 'til you make it, Faking and verifying behavior with Sinon.JS mocks, Deciding when to mock
    • behavior, verifying with / Faking and verifying behavior with Sinon.JS mocks, Deciding when to mock
    • behavior, faking with / Faking and verifying behavior with Sinon.JS mocks, Deciding when to mock
    • Backbone.js components, testing / Testing Backbone.js components with stubs and mocks, Ensuring stubs and mocks are actually bound
  • Model-View-Controller (MVC)
    • about / A Backbone.js refresher
  • models
    • about / A Backbone.js refresher, Models
  • MongoDB
    • URL / Faking the remote backend in a Backbone.js application
  • multiple environment aggregators / Multiple environment aggregators

N

  • Node.js Express
    • URL / Faking the remote backend in a Backbone.js application
  • Notes application
    • about / Getting acquainted with the Notes application
    • anatomy / The anatomy of the Notes application
    • router, testing / The Notes application router
    • components, searching / Finding the rest of the Notes application components
  • Notes application single note view
    • about / The Notes application single note view
  • Notes list item view / The Notes list item view, The list item view
  • Notes menu bar view
    • about / The Notes menu bar view, The menu bar view
    • testing / Testing and spying on the menu bar view
    • spying / Testing and spying on the menu bar view
  • Notes single note view
    • about / The Notes single note view, The single note view
    • testing / Testing the single note view

O

  • object method spies
    • about / Object method spies
  • objects
    • chaining / Chaining objects and assertions
  • object validation, Chai / Object and array validation

P

  • partial integrations
    • about / Partial integrations
  • partial integration tests
    • about / Testing concepts, approaches, and planning
  • performance/load tests
    • about / Testing concepts, approaches, and planning
  • PhantomJS
    • about / Getting the test libraries, Remote controlled web browsers, Headless web browsers
    • URL / Headless web browsers
    • headless testing / Headless testing with PhantomJS
    • installing / Installing PhantomJS and the supporting tools
    • Backbone.js tests, running with / Running Backbone.js tests with PhantomJS
  • project style
    • deciding / Deciding on the project style

Q

  • QUnit-styled interface
    • about / Mocha test interfaces
  • QUnit test framework
    • URL / Mocha test interfaces

R

  • regression tests
    • about / Testing concepts, approaches, and planning
  • remote backend
    • faking, in Backbone.js application / Faking the remote backend in a Backbone.js application
  • remote controlled web browsers / Remote controlled web browsers
  • restore() function / Object method spies
  • router routes
    • about / Ensuring stubs and mocks are actually bound
  • routers
    • about / A Backbone.js refresher, Routers
    • testing, in Notes application / The Notes application router
  • router tests
    • running / Running the view and router tests

S

  • Safari
    • about / Headless web browsers
  • sandbox
    • about / Playing in the sandbox with Sinon.JS test helpers
  • Sauce Labs
    • about / Remote controlled web browsers
    • URL / Remote controlled web browsers
  • Selenium
    • about / Remote controlled web browsers
    • URL / Remote controlled web browsers
  • server.respond() method / The fake server API
  • server.respondWith(method, url, response) method / The fake server API
  • server.respondWith(response) method / The fake server API
  • server.restore() method / The fake server API
  • Server Application
    • about / Selecting a Backbone.js application to test
  • setTimeout() function / Test timing and slow tests, Playing in the sandbox with Sinon.JS test helpers
  • setup() function / The Mocha test runner
  • setup() method / Mocha TDD and Chai assert styles
  • Showdown
    • about / The anatomy of the Notes application
  • simulated browser environments / Simulated browser environments
  • single note view
    • about / The single note view
    • testing / Testing the single note view
  • Sinon-Chai plugin
    • about / Introducing and installing Chai plugins
  • sinon.fakeServer.create() method / The fake server API
  • Sinon.JS
    • about / Getting the test libraries, Sinon.JS, Getting to know Sinon.JS
    • URL / Sinon.JS, Parting thoughts, next steps, and future ideas
    • spying, on functions / Spying on functions with Sinon.JS
    • test helpers / Playing in the sandbox with Sinon.JS test helpers
    • URL, for sandbox documentation / Playing in the sandbox with Sinon.JS test helpers
    • spy API / Delving into the Sinon.JS spy API
    • asynchronous callbacks, in stubbed methods / The stub API
  • Sinon.JS plugin
    • about / The Sinon.JS plugin
    • spy-related assertions / The Sinon.JS plugin
  • Sinon.JS stubs
    • method behaviors, replacing with / Replacing method behaviors with Sinon.JS stubs
  • Sinon.JS test helpers
    • about / A few more Sinon.JS test helpers
    • fake timers / Fake timers
    • fake servers / Fake servers
  • sinon.mock(obj) method / The mock API
  • sinon.stub() method / The stub API
  • sinon.stub(obj) method / The stub API
  • sinon.stub(obj, methodName) method / The stub API
  • sinon.stub(obj, methodName, fn) method / The stub API
  • sinon.test sandbox function / Playing in the sandbox with Sinon.JS test helpers
  • slow tests
    • about / Test timing and slow tests
  • spies
    • about / Sinon.JS, Fake it 'til you make it
    • used, for testing Backbone.js components / Testing Backbone.js components with spies
  • spy.alwaysReturned(obj) method / The spy API
  • spy.callCount(num) method / The spy API
  • spy.called method / The spy API
  • spy.calledWith* method / The spy API
  • spy.firstCall property / The spy call API
  • spy.getCall(n) method / The spy call API
  • spy.lastCall property / The spy call API
  • spy.notCalledWith* method / The spy API
  • spy.returned(obj) method / The spy API
  • spy.secondCall property / The spy call API
  • spy.thirdCall property / The spy call API
  • spy.threw() method / The spy API
  • spy API
    • about / The spy API
  • spy assertions
    • about / Spy assertions
  • spyCall.calledOn(obj) method / The spy call API
  • spyCall.calledWith* method / The spy call API
  • spyCall.notCalledWith* method / The spy call API
  • spyCall.returnValue property / The spy call API
  • spyCall.threw() method / The spy call API
  • spy call API
    • about / The spy call API
  • stub.callsArg* method / The stub API
  • stub.callsArgWith(index, arg1, arg2, ...) method / The stub API
  • stub.returns(obj) method / The stub API
  • stub.throws() method / The stub API
  • stub.yields(arg1, arg2, ...) method / The stub API
  • stub.yieldsOn(context, arg1, arg2, ...) method / The stub API
  • stub.yieldsTo(property, arg1, arg2, ...) method / The stub API
  • stub.yieldsToOn(property, context, arg1, arg2, ...) method / The stub API
  • stub API
    • about / The stub API
    • URL, for documentation / The stub API
  • stubs
    • about / Sinon.JS, Fake it 'til you make it, Getting started with stubs
    • Backbone.js components, testing / Testing Backbone.js components with stubs and mocks, Ensuring stubs and mocks are actually bound
  • suite() method / Mocha TDD and Chai assert styles
  • suiteSetup() method / Mocha TDD and Chai assert styles
  • suiteTeardown() method / Mocha TDD and Chai assert styles

T

  • teardown() method / Mocha TDD and Chai assert styles
  • templates
    • about / A Backbone.js refresher, Templates
  • test
    • Backbone.js application, selecting for / Selecting a Backbone.js application to test
  • test() method / Mocha TDD and Chai assert styles
  • Test-Driven Development (TDD) / Chai
    • about / Test paradigms and methods, Mocha test interfaces
  • testable application code
    • writing / Writing testable application code
  • test code
    • organizing, into topics / Organizing topics and specifications into test suites
    • orgainizing, into application components / Organizing topics and specifications into test suites
  • test development
    • tips / Test development tips, tricks, and hints, Isolating and excluding tests
    • tricks / Test development tips, tricks, and hints, Isolating and excluding tests
    • hints / Test development tips, tricks, and hints, Isolating and excluding tests, Writing testable application code
  • test doubles
    • about / Fake it 'til you make it
  • test driver page
    • about / The test driver page
  • Testem
    • URL / Multiple environment aggregators
  • test failures
    • about / Test failures
  • test infrastructure
    • scenarios / The world of testing beyond humans and browsers, Continuous deployment
    • continuous integration / Continuous integration
    • continuous deployment / Continuous deployment
  • testing
    • application, reconfiguring for / Reconfiguring the application for testing
  • testing and automation techniques
    • about / Parting thoughts, next steps, and future ideas
    • style checking / Parting thoughts, next steps, and future ideas
    • code coverage / Parting thoughts, next steps, and future ideas
  • test interfaces, Mocha
    • Behavior-Driven Development (BDD) / Mocha test interfaces
    • Test-Driven Development (TDD) / Mocha test interfaces
    • exports / Mocha test interfaces
    • QUnit-styled / Mocha test interfaces
  • test libraries
    • obtaining / Getting the test libraries, Mocha, Chai, Sinon.JS
    • Mocha / Mocha
    • Chai / Chai
    • Sinon.JS / Sinon.JS
  • test methods
    • about / Test paradigms and methods
  • test paradigms
    • about / Test paradigms and methods
  • test plan
    • about / Testing concepts, approaches, and planning
  • test report
    • about / The first test report
    • actions / Test report actions
  • test repository structure
    • designing / Designing an application and test repository structure
  • test results
    • running / The first test report, Test report actions
    • assessing / The first test report, Test report actions
  • tests
    • setting up / Setting up and writing our first tests
    • writing / Setting up and writing our first tests
    • adding / Adding some tests
    • orgainizing / Getting the application and tests ready to run
    • starting up / Starting up and winding down tests
    • winding down / Starting up and winding down tests
    • asynchronous behavior / Asynchronous behavior in tests
    • automating, in code samples / Automating tests in the code samples
  • test speed
    • about / Test timing and slow tests
  • test style
    • selecting / Choosing a test style that fits
  • throw assertion / Errors
  • TodoMVC
    • URL / The anatomy of the Notes application
  • topics
    • test code, organizing into / Organizing topics and specifications into test suites
  • Travis
    • URL / Continuous integration
    • about / Continuous integration

U

  • unit tests
    • about / Testing concepts, approaches, and planning
  • usability tests
    • about / Testing concepts, approaches, and planning
  • utilities
    • about / Utilities

V

  • value assertions, Chai / Basic value assertions
  • view events
    • about / Ensuring stubs and mocks are actually bound
  • views
    • about / A Backbone.js refresher, Views
    • supporting / Testing and supporting Backbone.js views
    • running / Running the view and router tests
  • view tests
    • HTML fixtures, creating for / Creating HTML fixtures for view tests
    • hooking up / Hooking up and running the view tests
    • running / Hooking up and running the view tests
  • view test suite
    • about / Walking through the view test suite

W

  • watchers
    • about / Other scenarios
  • web drivers
    • about / Remote controlled web browsers
  • WebKit
    • about / Headless web browsers
    • URL / Headless web browsers

X

  • XMLHttpRequest (XHR) / Fake servers

Z

  • Zombie.js
    • URL / Simulated browser environments
    • about / Simulated browser environments