Jasmine Cookbook

Over 35 recipes to design and develop Jasmine tests to produce world-class JavaScript applications
Preview in Mapt

Jasmine Cookbook

Munish Sethi

Over 35 recipes to design and develop Jasmine tests to produce world-class JavaScript applications
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Jasmine Cookbook Book Cover
Jasmine Cookbook
$ 39.99
$ 28.00
Robot Operating System Cookbook Book Cover
Robot Operating System Cookbook
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $44.98
Add to Cart

Book Details

ISBN 139781784397166
Paperback276 pages

Book Description

Jasmine provides a rich set of libraries to design and develop tests for JavaScript applications. Its tests aim to run on any JavaScript-enabled platform and have easy-to-read syntax.

This book is a comprehensive guide to designing and developing Jasmine tests to produce world-class software. The recipes are elaborated using examples from a real-world application, which involves various aspects of designing and developing tests from simple to complex level. You will learn how to create tests for jQuery and Ajax, HTML and JSON fixtures, CoffeeScript, and AngularJS. By learning and applying the best practices throughout this book, you can deliver your applications with zero defects and ensure success for you and your clients.

Table of Contents

Chapter 1: Getting Started with Jasmine Framework
Introduction
Writing your first Jasmine test
Adding specs to your Jasmine test
Adding expectations and matchers to the test
Applying different matchers to the Jasmine test
Applying setup and teardown functions to the Jasmine test
Using the "this" keyword
Chapter 2: Jasmine with TDD and BDD Processes
Introduction
Writing Jasmine tests using TDD and BDD processes
Creating a Jasmine test for new code using TDD and BDD
Designing Jasmine tests for existing code using TDD and BDD
Defining nested suites to write more meaningful specs
Chapter 3: Customizing Matchers and Jasmine Functions
Introduction
Writing a Jasmine test using a custom equality tester function
Writing Jasmine tests with custom matchers
Writing Jasmine tests for exceptions
Declaring pending specs with Jasmine tests
Chapter 4: Designing Specs from Requirement
Introduction
Writing useful specs by analyzing the test requirements
Implementing the Jasmine test corresponding to the specs
Applying Acceptance Criteria to the Jasmine test
Organizing Jasmine specs into groups and subgroups
Chapter 5: Jasmine Spies
Introduction
Writing Jasmine tests using the spyOn() method and special matchers for spies
Writing Jasmine tests using tracking properties
Writing Jasmine tests with your own custom spy method
Using jasmine.any and jasmine.objectContaining
Writing Jasmine tests to mock the JavaScript timeout functions
Chapter 6: Jasmine with AJAX, jQuery, and Fixtures
Introduction
Writing Jasmine specs for AJAX
Designing Jasmine specs with HTML and JSON fixtures
Writing Jasmine specs for jQuery
Writing Jasmine specs using custom jQuery matchers
Writing Jasmine specs for asynchronous operations using the done() function
Chapter 7: Code Coverage with Jasmine Tests
Introduction
Configuring code coverage tools
Generating code coverage using karma and istanbul
Writing Jasmine specs for uncovered branches/code
Increasing code coverage for existing code
Chapter 8: Jasmine with Other Tools
Introduction
Writing Jasmine tests for AngularJS
Using Jasmine with CoffeeScript
Writing Jasmine tests for Node.js
Chapter 9: Developing JavaScript Apps Using Jasmine – a Real-time Scenario
Introduction
Defining Jasmine specs corresponding to a user story
Implementing Jasmine specs with Web/HTML
Implementing Jasmine tests with a Data-Driven approach
Creating Jasmine tests for a change request

What You Will Learn

  • Develop JavaScript applications with Jasmine using the behavior-driven development (BDD) process
  • Apply custom matchers by enhancing your Jasmine tests to test specific features or functionality
  • Design Jasmine specs for jQuery and Ajax with HTML and JSON fixtures
  • Generate code coverage analysis for JavaScript code using Karma and Istanbul
  • Create Jasmine tests for CoffeeScript and AngularJS
  • Implement E2E (end-to-end) Jasmine specs for JavaScript applications to simulate a real-time scenario

Authors

Table of Contents

Chapter 1: Getting Started with Jasmine Framework
Introduction
Writing your first Jasmine test
Adding specs to your Jasmine test
Adding expectations and matchers to the test
Applying different matchers to the Jasmine test
Applying setup and teardown functions to the Jasmine test
Using the "this" keyword
Chapter 2: Jasmine with TDD and BDD Processes
Introduction
Writing Jasmine tests using TDD and BDD processes
Creating a Jasmine test for new code using TDD and BDD
Designing Jasmine tests for existing code using TDD and BDD
Defining nested suites to write more meaningful specs
Chapter 3: Customizing Matchers and Jasmine Functions
Introduction
Writing a Jasmine test using a custom equality tester function
Writing Jasmine tests with custom matchers
Writing Jasmine tests for exceptions
Declaring pending specs with Jasmine tests
Chapter 4: Designing Specs from Requirement
Introduction
Writing useful specs by analyzing the test requirements
Implementing the Jasmine test corresponding to the specs
Applying Acceptance Criteria to the Jasmine test
Organizing Jasmine specs into groups and subgroups
Chapter 5: Jasmine Spies
Introduction
Writing Jasmine tests using the spyOn() method and special matchers for spies
Writing Jasmine tests using tracking properties
Writing Jasmine tests with your own custom spy method
Using jasmine.any and jasmine.objectContaining
Writing Jasmine tests to mock the JavaScript timeout functions
Chapter 6: Jasmine with AJAX, jQuery, and Fixtures
Introduction
Writing Jasmine specs for AJAX
Designing Jasmine specs with HTML and JSON fixtures
Writing Jasmine specs for jQuery
Writing Jasmine specs using custom jQuery matchers
Writing Jasmine specs for asynchronous operations using the done() function
Chapter 7: Code Coverage with Jasmine Tests
Introduction
Configuring code coverage tools
Generating code coverage using karma and istanbul
Writing Jasmine specs for uncovered branches/code
Increasing code coverage for existing code
Chapter 8: Jasmine with Other Tools
Introduction
Writing Jasmine tests for AngularJS
Using Jasmine with CoffeeScript
Writing Jasmine tests for Node.js
Chapter 9: Developing JavaScript Apps Using Jasmine – a Real-time Scenario
Introduction
Defining Jasmine specs corresponding to a user story
Implementing Jasmine specs with Web/HTML
Implementing Jasmine tests with a Data-Driven approach
Creating Jasmine tests for a change request

Book Details

ISBN 139781784397166
Paperback276 pages
Read More

Read More Reviews

Recommended for You

Jasmine JavaScript Testing - Second Edition Book Cover
Jasmine JavaScript Testing - Second Edition
$ 27.99
$ 19.60
Angular Test-Driven Development - Second Edition Book Cover
Angular Test-Driven Development - Second Edition
$ 31.99
$ 22.40
JavaScript: Functional Programming for JavaScript Developers Book Cover
JavaScript: Functional Programming for JavaScript Developers
$ 63.99
$ 44.80
Node.js Design Patterns - Second Edition Book Cover
Node.js Design Patterns - Second Edition
$ 39.99
$ 28.00
Node.js Design Patterns Book Cover
Node.js Design Patterns
$ 29.99
$ 6.00
Learning ECMAScript 6 Book Cover
Learning ECMAScript 6
$ 27.99
$ 19.60