Stop wasting your time

wrestling with incomplete and confusing tutorials

  • Piecing together the docs is tough The documentation is not self-explanatory, one tutorial says one thing and another says something completely different.
  • Googling only takes you so far... There are not many good screencasts or tutorials out there that teach how to maximize the framework. Some teach the basics, but nothing that shows how to fit everything together?
  • Time is money; don't waste it sifting through blogs.Not only does it take a few trips around the community to have a basic understanding, but it's tough to find the answer you need.
  • What the heck is a _____? The vocabulary is foreign, when are you supposed to use a directive, a filter, or a factory? And seriously, what the does $apply and $digest mean?
  • How does it all fit together? The internals of AngularJS 1.x sparse and few and far between. How do you know how it all fits together?
  • Still not hitting deadlines faster. You still have a job to do and learning AngularJS hasn't made it any more achievable

Ready to master AngularJS 1.x?

  • What if you could master the entire framework – with solid foundations – in less time without beating your head against a wall? Imagine how quickly you could work if you knew the best practices and the best tools?
  • Stop wasting your time searching and have everything you need to be productive in one, well-organized place, with complete examples to get your project up without needing to resort to endless hours of research.
  • You will learn what you need to know to work professionally with ng-book: The Complete Book on AngularJS 1.x or get your money back.
Jump to packages

Get up and running quickly

Within the first few minutes, you'll know enough Angular concepts to start writing your modern webapp. This is perfect as a reference or as a tutorial.

Comprehensive topics

You'll learn core Angular concepts - from how Angular works under the hood to rich animations, from in-depth testing to real-world applications.

Best practices

Learn AngularJS best practices, such as testing, code organization, and how to structure your app for performance. We'll walk through practical, common examples of how to implement complete components of your applications.

Up to date

The book is constantly updated with the latest tips and tricks of Angular. Don't worry about being out-of-date, this book covers the latest version. You'll get access to all updates, for free.

What's in it?

  • How to use AngularJS to your advantage
  • How to build and use controllers and work with scopes
  • How to build views, templates, and best practices
  • You'll learn to master the core directives and build your own custom directives
  • You'll learn how to implement real-world authentication
  • How to test all parts of your applications
  • You'll know exactly how Angular works, from bootstrapping to garbage collection.
  • You'll communicate with back-end services of your choosing. You'll walk through how to connect with Google's APIs
  • How to master routing, routing, routing
  • An in-depth overview of the most common XHR options
  • How to get Angular to work with that pesky Internet Explorer
  • How to talk directly to your backend database, such as MongoDB
  • And much, much more...
Read the current table of contents

Testing Angular Applications: How to Measure Reliability and Verify Code Quality

Reliable Angular applications are built on more than components that render successfully. They need tests that expose incorrect behavior, verify interactions across the UI and services, and give developers evidence that a change is safe to release.

Angular has always encouraged developers to organize code in ways that make it testable. That principle runs through the history of ng-book, from AngularJS 1.x controllers, services, and directives to component-based Angular applications. The frameworks and testing tools have changed, but the engineering problem remains: how do we know that the application does what its users and maintainers expect?

What reliability means in an Angular application

A test suite measures particular behaviors under particular conditions; it does not prove that an application is free of defects. Reliability is better understood as the ability to deliver expected behavior consistently, including when users enter invalid data, an API responds slowly, or a component receives an unexpected state. The most useful tests describe those expectations explicitly and fail when the code violates them.

Code quality overlaps with reliability without being identical to it. Readable components, clear service boundaries, small interfaces, and predictable dependency injection make defects easier to detect and fixes easier to review. A passing test suite cannot compensate for confusing architecture, but well-designed tests can make that architecture easier to improve.

Build a testing strategy around the application's risks

Unit tests: verify rules and decisions

Unit tests target a small behavior such as a validation rule, a formatter, a calculation, or a service method. They should cover normal inputs, boundaries, and invalid cases rather than merely confirm that a class can be instantiated. For example, a shopping-cart calculation deserves tests for an empty cart, multiple quantities, rounding behavior, and invalid discounts. These checks run quickly and identify logic regressions close to their source.

Component tests: verify rendered behavior

An Angular component combines a class with a template and event bindings. A component test should confirm the result a user would observe: a button changes a value, a validation message appears, or loading and error states render correctly. Testing a component's internal property alone may miss a broken template binding. Angular's TestBed and ComponentFixture let a test create a component, interact with its DOM, and inspect its rendered output.

Integration tests: verify boundaries

Integration tests examine cooperation between components, services, routing, and network-facing code. They are especially useful at boundaries where assumptions tend to break: an API may omit a field, a route guard may reject access, or a failed request may leave the interface in an inconsistent state. Most of these cases should use controlled dependencies and simulated responses so tests remain deterministic.

End-to-end tests: verify critical workflows

End-to-end tests exercise the application through a browser, often from login or navigation through submission and confirmation. Tools such as Playwright can check real browser behavior across supported engines. Keep this layer focused on business-critical journeys, because browser-driven tests cost more to maintain and may fail for reasons unrelated to the application logic.

Use the right tools for Angular and AngularJS

There is an important version distinction. AngularJS 1.x, the framework at the center of the original ng-book, commonly used Jasmine with Karma and the angular-mocks package. Its ngMock helpers made it possible to inject services, control timers, and simulate HTTP responses with $httpBackend. Those techniques remain relevant when maintaining legacy applications, but official AngularJS support ended in January 2022. Test coverage does not replace a security and migration plan for unsupported software.

Modern Angular uses different component and dependency-injection APIs. For new Angular CLI projects, the official testing setup uses Vitest, while Karma remains supported in existing and specially configured projects. Before copying a testing tutorial, check its Angular version, test runner, and package versions. A test written for an AngularJS scope or an older Angular module setup cannot simply be dropped into a current standalone component project.

A practical Angular component test

A useful test should exercise observable behavior rather than implementation details. This simplified standalone component and Vitest example checks what happens when a user activates a button:

import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { describe, expect, it } from 'vitest';

@Component({
  standalone: true,
  template: `<button (click)="count = count + 1">Add</button>
             <output>{{ count }}</output>`
})
class CounterComponent {
  count = 0;
}

describe('CounterComponent', () => {
  it('updates the displayed count after a click', async () => {
    const fixture = TestBed.createComponent(CounterComponent);
    await fixture.whenStable();

    const button = fixture.nativeElement.querySelector('button');
    button.click();
    await fixture.whenStable();

    const output = fixture.nativeElement.querySelector('output');
    expect(output.textContent.trim()).toBe('1');
  });
});

The assertion inspects the rendered <output> element. That matters: if the button's event binding stopped working, or the template stopped displaying count, the test would expose the regression. More complex components should also cover accessible interaction, changing inputs, error states, and asynchronous rendering.

Test HTTP behavior without relying on live services

Frontend reliability often depends on a server the frontend team does not control. Unit and integration tests should not fail because a staging API is offline or a shared database contains different records. In modern Angular, provideHttpClientTesting() and HttpTestingController let tests inspect outgoing HTTP requests and supply controlled responses. A meaningful test can assert the method and URL, return a successful payload, and then repeat the scenario with a timeout or server error.

For instance, an account screen should not display stale personal data after a failed refresh. A test can simulate the error, check that an appropriate message is shown, and confirm that no unexpected requests remain outstanding. Angular documents these patterns in its HTTP testing guide. On AngularJS 1.x, the corresponding legacy technique typically used $httpBackend; the APIs should not be confused.

Measure quality with more than a pass count

A green test run is useful evidence, but pass counts on their own say little about whether important behaviors were tested. Combine several measures and evaluate them in context:

  • Behavior coverage: Which critical workflows, error paths, and business rules have explicit tests?
  • Code coverage: Which lines and branches were exercised? High coverage can coexist with weak assertions, so treat it as a diagnostic signal rather than a quality guarantee.
  • Defect escape rate: Which kinds of failures were discovered only after release, and what earlier test might have exposed them?
  • Flakiness: Does a test alternate between passing and failing without a code change? Frequent flaky failures reduce trust in the entire suite.
  • Feedback time: Can developers run the tests that matter before submitting a change, while the broader checks complete in continuous integration?

For a checkout flow, a handful of tests covering totals, validation failures, server rejection, and successful confirmation may be more valuable than hundreds of assertions against low-risk presentation details. Prioritize by the consequences of failure, not by the easiest number to increase.

Keep tests deterministic and maintainable

Flaky Angular tests frequently share a small set of causes: uncontrolled timers, unawaited asynchronous work, network dependence, reused mutable state, and selectors that break with minor layout changes. Isolate test data, use framework-supported mechanisms to wait for rendering, and reset mocks between tests. Prefer testing the public behavior of components and services instead of coupling assertions to private methods.

Review tests alongside production code. When a feature changes, update the expected behavior deliberately; do not weaken assertions merely to make the build pass. A failed test can signal an intended product change, a faulty assumption, or a real regression. The job of the developer is to establish which explanation the evidence supports.

Make testing part of the delivery workflow

A practical pipeline runs fast unit and component tests during development and on every pull request. Integration tests can validate service contracts, while a smaller set of end-to-end checks exercises release-critical paths. Run linters and type checks as complementary safeguards: they can catch problems that behavioral tests may never encounter. Preserve failure logs and test artifacts in continuous integration so an engineer can reproduce the result instead of guessing.

When tests fail, record the affected application version, the test environment, the precise failure, and the smallest reliable reproduction. A useful failure report tells a teammate what happened, what was expected, and what information remains uncertain.

How to document software testing methods and results

Testing becomes more valuable when its results can be inspected and repeated. A concise test record should identify the feature under examination, the test objective, the environment and code revision, the input conditions, the procedure, the observed outcome, and the acceptance criterion. If a test fails, separate the observation from the proposed explanation: an API error response is evidence, while the claim that a particular dependency caused it is a hypothesis until verified.

This discipline applies equally to engineering incident reviews, quality-assurance summaries, and a computer science lab report. Presenting software testing methods and results clearly means making the procedure reproducible, distinguishing measured outcomes from interpretation, and documenting limitations such as mocked services or browser coverage. These are not merely reporting conventions; they help other developers judge whether the evidence actually supports a release decision.

Reliable Angular software comes from testable design

Angular testing is most effective when it influences design from the beginning. Small services, components with explicit responsibilities, observable UI behavior, and clear API boundaries give developers meaningful things to verify. The tools have changed since AngularJS 1.x, but disciplined testing still follows the same pattern: define expected behavior, exercise it under controlled conditions, inspect the result, and preserve enough evidence to reproduce the finding. That is how a test suite becomes a trustworthy part of software maintenance rather than a collection of green check marks.

Too good to be true?

Sample chapter image

Grab a sample chapter and check it out for yourself. Sign up for our mailing list and get the sample chapters for free! You'll only receive email about the book and updates. We never send spam, ever and it's easy to unsubscribe.

It can take up to an hour to deliver the sample app. If you don't receive the sample chapters within the hour, write us and I'll send them to you manually.

Meet the author

Ari Lerner

Hey! I'm Ari Lerner, author, developer with more than 20 years of experience, and co-founder of Fullstack.io. I've been using AngularJS for a long time and am a recognized expert in the field.

I co-run ng-newsletter, speak at conferences, constantly produce content all about AngularJS, recently released Riding Rails with AngularJS, and teach in-person classes at Hack Reactor.

I constantly speak about AngularJS and more. Check out some of my latest talks and workshops, such as Angular on Mobile, Powering physical interfaces with Angular at ngConf, and Workshop: AngularJS for beginners

Get it now

The book and complete source

$ 39

  • 600+ pages of professional-grade Angular ebook content
  • Completely DRM-free PDF, mobi, and epub formatted ebook
  • Learn Angular from the inside out
  • Learn the right way to build Angular apps
  • Build advanced Angular apps within minutes
  • Have the complete library available at your fingertips
  • The code for every sample in the book to get you going quickly
Basic
Get it

Book, source code, videos, and sample app

$ 79

  • 600+ pages of professional-grade Angular ebook content
  • Completely DRM-free PDF, mobi, and epub formatted ebook
  • Learn Angular from the inside out
  • Learn the right way to build Angular apps
  • Build advanced Angular apps within minutes
  • Have the complete library available at your fingertips
  • The code for every sample in the book to get you going quickly
  • The mini-ebook describing step-by-step how to build the sample app
  • The complete code for the sample app
  • 3 hour long beginner Angular screencast
Most popular
Get it

Team license

$ 299

  • 600+ pages of professional-grade Angular ebook content
  • Completely DRM-free PDF, mobi, and epub formatted ebook
  • Your team will be able to build advanced Angular apps within minutes
  • Your team will learn angular from the inside out
  • Your team will build Angular apps with Best practices from the start
  • Have the complete library available for your team
  • The code for every sample in the book to get you going quickly
  • An additional ebook describing step-by-step how to build the sample app
  • The complete code for the sample app
  • 3 hour long beginner Angular screencast
  • Team license for up to 10 team members
  • Immediate invoice billing service
Team & save $200
Get it

Want the print version instead?

The print version of the book is available through Amazon and Createspace.

Due to Amazon's authorship tools and the laws of physics, we cannot update paper copies of the book (although it would be very cool if we could). Additionally, we do not provide updates through Amazon as we have no control over their publishing platform.

Community praise for ng-book

Akeel Nazir

Front-end developer at Cigna Insurance

I would like to thank you for writing the only meaningful book in the AngularJS space. I have so far bought all the books, and yours is the only one that I am able to follow. Thank you very much for your effort.

Ryan Lelek

Thiel Fellow (2012) & Founder at Orbzah

Your book arrived yesterday (straight off the presses it seems), and I've powered through 130+ pages. Page 89 (never use raw scope values, always in a model object or array) has likely already saved hours of headaches, having the book pay for itself.

Nick Lyons

CareWorks Tech Web Developer

Been working on some angular projects with the help of your book and articles. Couldn't have done it without your great articles.

Jim Wheaton

Senior software developer at the Rick Hansen Institute in Vancouver, B.C

Thanks for producing this material. I've spent countless hours combing the web, reading existing books, and watching a million tutorials to get up speed on angular, so it's nice to find such a comprehensive resource.

David Handel

Co-founder of Ask Your Target Market

I just finished watching the 2:54 long beginner series video. That three hours is pure solid gold. It's the best video overview of Angular I've seen. Thank you for it. The upgrade price to get it was worth every penny.

John Cole

CTO at Integrated Data Services

Great job on the book! I have found it to be the best software book I've ever purchased - easy to get started and it properly explains the concepts

Remo Lötscher

Front-end developer at PostFinance

As I'm just starting to use AngularJS for a business project your book is an important and valuable source for my daily work. Thank you very much for all your effort!

Pierre Lauret

Software engineer at General Electric

The Testing chapter saved my lot of time when I wanted to setup my test workflow. Thanks to your book, my test workflow is up and running very well.

Matt Trigwell

Founder of BluefrogPOS

Thank you so much for the effort that you have put into this book. I'm really getting into it and enjoying the content and style in which you have written it.

Morgan Polotan

Engineering fellow @thinkful

I can tell #ngbook will become the definitive guide to #Angular. A big thank you from @thinkful engineering!

Mikey Reppy

Application Developer

To save myself from my javascript I got ng-book: The Complete Book on AngularJS

Oliver Forral

Application Developer

First of all, I want to say thank you for making this book. I'm enjoying reading it and I'm learning so much about AngularJS.

Florian Witteler

Application Developer

The chapters I studied so far are excellent. I got a lot of insight from the security chapter. You guys did a very good job on explaining everything in great detail but also very fluent. Don't know, how to translate it correctly: I mean, it wasn't boring to read ;-) I'm so glad, I found your book.

Jennifer Dixon

Front End Developer

Anyone who wants to understand Angular should be reading this book. There are other informative books out there, as well as the excellent egghead.io videos, but none written with the context you wrote yours with. I really found this one to be the easiest to understand, because the parts of an app and the whole of an app are both explained so clearly.

Nikolaj Ivancic

Owner Congral, LLC

I am a software developer / designer / manager for well over 30 year and in that period of time have developed a very good taste for software books; this should be taken as an indication that Ari has done a stellar job and that I am very excited to read the whole book.

High quality and community driven

This book has an emphasis on high quality and deep organization. We personally respond to requests for content and release updates regularly to work with the latest in the Angular community.

No dealing with publishers and black-box publishing companies. Talk directly to us, the authors.

As independent authors, we survive only if you are satisfied and only by making the highest quality book on AngularJS as possible.

Jump to packages

Contact us

If you have any questions or concerns, feel free to email us at us at fullstack.io.