#Angular Test-Driven Development - Second Edition This is the code repository for Angular Test-Driven Development - Second Edition, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.
About the Book
This is a complete guide that shows you testing techniques with Karma that will help you perform unit testing and end-to-end testing with Protractor. It will show you how to optimize your Angular development process using TDD techniques and ensure your final project is free of bugs. All examples in this book are based on Angular v2 and are compatible with Angular v4.
We start by reviewing the TDD life cycle, TDD in the context of JavaScript, and various JavaScript test tools and frameworks. You will see how Karma and Protractor can make your life easier while running JavaScript unit tests. We will enable you to build a test suite for an Angular application and build a testable medium-to-large scale Angular application by handling REST API data.
Building on the initial foundational aspects, we move on to testing for multiple classes, partial views, location references, CSS, and the HTML element. In addition, we will explore how to use a headless browser with Karma. We will also configure a Karma file to automate the testing and tackle elements of Angular (components, services, classes, and broadcasting) using TDD.
Finally, you will find out how to pull data using an external API, set up and configure Protractor to use a standalone Selenium server, and set up Travis CI and Karma to test your application. ##Instructions and Navigation All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.
The code will look like the following:
var calculator = {
multiply : function(amount1, amount2) {
return amount1 * amount2;
}
};
In this book, we have used Node Package Manager (npm) as our command tool to run the application and various testing tools. So it's a prerequisite to have npm globally installed on your operating system. To install it, you must have Node.js installed on your operating system. We will not look at how to install Node.js and npm. There are a lot of resources already available for installing them on any operating system.
##Related Products
###Suggestions and Feedback Click here if you have any feedback or suggestions.