Jasmine JavaScript Testing - Second Edition

Test your JavaScript applications efficiently using Jasmine and React.js

Jasmine JavaScript Testing - Second Edition

This ebook is included in a Mapt subscription
Paulo Ragonha

Test your JavaScript applications efficiently using Jasmine and React.js
$0.00
$23.80
$34.00
$29.99p/m after trial
RRP $27.99
RRP $34.00
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781785282041
Paperback134 pages

Book Description

Take your testing of JavaScript applications to a new level of efficiency and reliability with the help of this book. Starting with the fundamentals of Jasmine and behavior-driven development (BDD), you will learn about tooling and automation. You will learn how to create a sustainable code base with the help of Jasmine. You will also take a look at integrated testing with React.js and Karma, and how you can speed this process up by faking AJAX requests. As you progress through the book, you will learn about the challenges of testing an application built on top of a framework and how you can prevent your application from suffering from dependency management. You will understand the concept of client-side and server-side rendering and test applications using React.js. You will also learn to automate using webpack and work with JavaScript module systems using ECMA Script 6 (ES6) modules.

By the end of this book, you will be a competent web developer with good knowledge and a strong understanding of how to efficiently use the Jasmine framework for testing purposes.

Table of Contents

Chapter 1: Getting Started with Jasmine
JavaScript – the bad parts
Jasmine and behavior-driven development
Downloading Jasmine
Summary
Chapter 2: Your First Spec
The Investment Tracker application
Jasmine basics and thinking in BDD
Setup and teardown
Nested describes
Summary
Chapter 3: Testing Frontend Code
Thinking in terms of components (Views)
The module pattern
Using HTML fixtures
Basic View coding rules
Testing Views with jQuery matchers
Summary
Chapter 4: Asynchronous Testing – AJAX
Acceptance criterion
Setting up the scenario
Writing the spec
Summary
Chapter 5: Jasmine Spies
The "bare" spy
Spying on an object's functions
Testing DOM events
Summary
Chapter 6: Light Speed Unit Testing
Jasmine stubs
Jasmine Ajax
Summary
Chapter 7: Testing React Applications
Project setup
Our first React component
The Virtual DOM
JSX
Component attributes (props)
Component events
Component state
Component life cycle
Composing components
Summary
Chapter 8: Build Automation
Module bundler – webpack
Test runner: Karma
Quick feedback loop
Optimizing for production
Static code analysis: JSHint
Continuous integration – Travis-CI
Summary

What You Will Learn

  • Understand and use the power of Jasmine to create better and more maintainable code bases
  • Drive your application development entirely by tests
  • Write modular and reusable code through the power of ECMA Script 6 (ES6) modules
  • Use asynchronous tests, stubs, and spies optimally
  • Test drive a React.js single-page application
  • Optimize your code to unleash the power of tooling and automation

Authors

Table of Contents

Chapter 1: Getting Started with Jasmine
JavaScript – the bad parts
Jasmine and behavior-driven development
Downloading Jasmine
Summary
Chapter 2: Your First Spec
The Investment Tracker application
Jasmine basics and thinking in BDD
Setup and teardown
Nested describes
Summary
Chapter 3: Testing Frontend Code
Thinking in terms of components (Views)
The module pattern
Using HTML fixtures
Basic View coding rules
Testing Views with jQuery matchers
Summary
Chapter 4: Asynchronous Testing – AJAX
Acceptance criterion
Setting up the scenario
Writing the spec
Summary
Chapter 5: Jasmine Spies
The "bare" spy
Spying on an object's functions
Testing DOM events
Summary
Chapter 6: Light Speed Unit Testing
Jasmine stubs
Jasmine Ajax
Summary
Chapter 7: Testing React Applications
Project setup
Our first React component
The Virtual DOM
JSX
Component attributes (props)
Component events
Component state
Component life cycle
Composing components
Summary
Chapter 8: Build Automation
Module bundler – webpack
Test runner: Karma
Quick feedback loop
Optimizing for production
Static code analysis: JSHint
Continuous integration – Travis-CI
Summary

Book Details

ISBN 139781785282041
Paperback134 pages
Read More

Read More Reviews