万本电子书0元读

万本电子书0元读

顶部广告

Backbone.js Testing电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Ryan Roemer

出  版  社:Packt Publishing

出版时间:2013-07-12

字       数:100.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
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 support for your backbone application, then this book is ideal for you.
目录展开

Backbone.js Testing

Table of Contents

Backbone.js Testing

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers and more

Why Subscribe?

Free Access for Packt account holders

Preface

What this book covers

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

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

2. Creating a Backbone.js Application Test Plan

A Backbone.js refresher

Selecting a Backbone.js application to test

Getting acquainted with the Notes application

The 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

3. Test Assertions, Specs, and Suites

Choosing a test style that fits

Mocha test interfaces

Chai assertion styles

Trying 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 tests

Testing 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

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 API

The 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

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

Deciding when to mock

The mock API

Testing Backbone.js components with stubs and mocks

Ensuring stubs and mocks are actually bound

The Notes list item view

The list item view

Testing the list item view

The Notes application router

Running the view and router tests

Finding the rest of the Notes application components

A few more Sinon.JS test helpers

Fake timers

Fake servers

The fake server API

Faking the remote backend in a Backbone.js application

Summary

6. Automated Web Testing

The world of testing beyond humans and browsers

Continuous integration

Continuous deployment

Other scenarios

Automating browser environments

Remote controlled web browsers

Simulated browser environments

Headless web browsers

Multiple environment aggregators

Headless testing with PhantomJS

Installing PhantomJS and the supporting tools

Running Backbone.js tests with PhantomJS

Automating tests in the code samples

Parting thoughts, next steps, and future ideas

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部