Angular 2 Test-driven Development, 2nd Edition
- Length: 252 pages
- Edition: 2nd Revised edition
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2017-02-08
- ISBN-10: B01D1HI9D8
- Sales Rank: #1152536 (See Top 100 Books)
Key Features
- Learn test-driven development (TDD) in JavaScript and see its power though clear examples
- Enhance your understanding with details on Karma and Protractor, and set up an Angular2 test suit with them
- A practical guide filled examples that focus on a wide range of testing techniques in a professional Angular2 application
Book Description
This is a complete guide that shows you testing techniques with Karma to perform unit testing and end-to-end testing with Protractor. It will show you how to optimize your Angular 2 development process using TDD techniques and ensure the final project is free of bugs.
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 Angular2 application and build a testable Angular2 medium-to-large scale 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 Angular2 (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.
What you will learn
- Get a clear overview of TDD in the context of JavaScript with a brief look at testing techniques, tools, and frameworks
- Get an overview of Karma and Protractor and create test suites for an Angular2 application with them
- Understand automated testing and implement headless automated tests with Karma
- 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
About the Author
Md. Ziaul Haq is a senior software engineer, full stack JavaScript developer, front-end architect, speaker, and certified scrum master who has worked in an upwork development team (remotely) as JavaScript Developer since 2011. He likes to play with new technologies, and is a passionate programmer loves to code daylong with JavaScript. Beside JavaScript, he has worked on LAMP technologies since an early stage in his career.
Ziaul Haq started his career in 2005 as a software developer, and in his 10-year career journey, he has worked with various software development hubs and start-ups, including UNICEF in different countries as a web consultant. He just completed his MS in computer science from United International University.
Ziaul Haq likes to watch soccer, and is a huge fan of Barca and Messi. He also likes to read blogs, moderate techi groups, and is very active in the local JavaScript community, where he is well known as jquerygeek.
Table of Contents
Chapter 1. Introduction to Test-Driven Development
Chapter 2. Details of JavaScript Testing
Chapter 3. The Karma Way
Chapter 4. End-to-End Testing with Protractor
Chapter 5. Protractor, a Step Ahead
Chapter 6. The First Step
Chapter 7. Flip Flop
Chapter 8. Telling the World