Book Image

Learning AngularJS Testing [Video]

By : Rudolf Olah
Book Image

Learning AngularJS Testing [Video]

By: Rudolf Olah

Overview of this book

<p>Finding the perfect balance between visual layout and coding has been a nightmare for developers, a problem which AngularJS deals with so well that in just a brief time since inception, it has become a favorite of developers all around the world. It has rightfully earned the tag of being a ‘Superheroic’ framework thanks to the diverse range of features it provides, and also as it helps the developers to build powerful applications without compromising on the visual aspects. Along with being a fully-featured package, it also presents an outstanding ability to be tested, which further helps to manage the applications and keeps them up and running!</p> <p>Learning Angular.JS Testing will help you to understand the different aspects involved in testing components, such as controllers and directives, with the help of a practical pizza ordering application right from the start, all the way to the end!</p> <p>We’ll start by constructing a project structure of our app, before installing and initializing various helpful tools such as Karma, Jasmine, and Grunt. We will create controllers for ordering the pizza, reviewing the order and test them be it with or without any dependencies. Not only that, but we will also go through testing the navigation between two controllers with the help of End2End testing. After that, we will create accordion directives for our application, unit test them, and resolve the errors if these tests fail. Furthermore, we will modify our services to use the $resource module and help them interact with REST API web services, as well as unit test them with the help of mocks and spies. Finally, we will create and test directives and controllers which fetch information from the service and display it.</p> <p>At the end of the course, you’ll be familiar with the various approaches involved in testing AngularJS code and will be able to implement them to develop bug-free and maintainable applications.</p> <h1>Style and Approach</h1> <p>Learning AngularJS Testing is a practical and hands-on guide which will help you grasp the various concepts and skills required for testing code in AngularJS applications. By the end of the course, you’ll be equipped with considerable knowledge to start testing your own apps.</p>
Table of Contents (4 chapters)
Chapter 4
Testing $resource-based REST API Services
Content Locked
Section 4
Displaying Information with a Controller
We need a controller to communicate with the server. We will hook up a controller to the service. - Create unit tests to update the controller that relies on the service - Update the controller to add the $resource-based service - Write an end2end test for the controller