AngularJS Test-driven Development

Implement the best practices to improve your AngularJS applications using test-driven development

AngularJS Test-driven Development

Learning
Tim Chaplin

1 customer reviews
Implement the best practices to improve your AngularJS applications using test-driven development
$17.99
$29.99
RRP $17.99
RRP $29.99
eBook
Print + eBook
$29.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

+ Collection
Free Sample

Book Details

ISBN 139781784398835
Paperback206 pages

Book Description

Starting with reviewing the test-driven development (TDD) life cycle, you will learn how Karma and Protractor make your life easier while running JavaScript unit tests. You will learn how Protractor is different from Selenium and how to test it entirely. This book is a walk-through to using TDD to build an AngularJS application containing a controller, model, and scope.

Building on the initial foundational aspects, you will expand to include testing for multiple controllers, partial views, location references, CSS, and the HTML element. In addition, you will explore using a headless browser with Karma. You will also configure Karma file watching to automate testing and tackle components of AngularJS (controller, service, model, and broadcasting) using TDD. At the end of this book, you will extend explore how to pull data using an external API, setting up and configuring Protractor to use a standalone Selenium server, and setting up Travis CI and Karma to test your application.

This book is a complete guide to testing techniques using Karma for unit testing and performing end-to-end testing with Protractor.

Table of Contents

Chapter 1: Introduction to Test-driven Development
An overview of TDD
Testing techniques
Self-test questions
Summary
Chapter 2: The Karma Way
JavaScript testing tools
JavaScript testing frameworks
Birth of Karma
Installing Karma
Using Karma with AngularJS
Self-test questions
Summary
Chapter 3: End-to-end Testing with Protractor
An overview of Protractor
Origins of Protractor
Protractor installation
Hello Protractor
Cleaning up the gaps
Self-test questions
Summary
Chapter 4: The First Step
Preparing the application's specification
Setting up the project
Top-down or bottom-up approach
Testing a controller
Bring on the comments
Make it better
Onwards and upwards
Self-test questions
Summary
Chapter 5: Flip Flop
Fundamentals
Creating a new project
Walk-through of Angular routes
Searching the TDD way
Show me some results!
Self-test questions
Summary
Chapter 6: Telling the World
Before the plunge
Harnessing the power of events
Self-test questions
Summary
Chapter 7: Give Me Some Data
REST – the language of the Web
Getting started with REST
Testing asynchronous calls
Making REST requests using AngularJS
Displaying products with REST
Testing middle-to-end
Testing end-to-end
Self-test questions
Summary

What You Will Learn

  • Implement unit and end-to-end testing with Karma and Protractor
  • Understand the workings of the file auto-watch feature and headless browser testing with Karma
  • Develop AngularJS controllers, services, and other components using the TDD approach
  • Implement the testing techniques with mocks, broadcast events, and asynchronous behavior
  • Integrate REST-based services and APIs into an application to extract data
  • Automate Karma unit tests with Travis CI
  • Get to know about TDD techniques, the TDD life cycle, and its power through clear examples to enhance your AngularJS applications

Authors

Table of Contents

Chapter 1: Introduction to Test-driven Development
An overview of TDD
Testing techniques
Self-test questions
Summary
Chapter 2: The Karma Way
JavaScript testing tools
JavaScript testing frameworks
Birth of Karma
Installing Karma
Using Karma with AngularJS
Self-test questions
Summary
Chapter 3: End-to-end Testing with Protractor
An overview of Protractor
Origins of Protractor
Protractor installation
Hello Protractor
Cleaning up the gaps
Self-test questions
Summary
Chapter 4: The First Step
Preparing the application's specification
Setting up the project
Top-down or bottom-up approach
Testing a controller
Bring on the comments
Make it better
Onwards and upwards
Self-test questions
Summary
Chapter 5: Flip Flop
Fundamentals
Creating a new project
Walk-through of Angular routes
Searching the TDD way
Show me some results!
Self-test questions
Summary
Chapter 6: Telling the World
Before the plunge
Harnessing the power of events
Self-test questions
Summary
Chapter 7: Give Me Some Data
REST – the language of the Web
Getting started with REST
Testing asynchronous calls
Making REST requests using AngularJS
Displaying products with REST
Testing middle-to-end
Testing end-to-end
Self-test questions
Summary

Book Details

ISBN 139781784398835
Paperback206 pages
Read More
From 1 reviews

Read More Reviews