Creating Robust Applications

Testing web applications is an important process to eliminate bugs. Tests ensure that the written code works as expected and the functionality is not broken on subsequent changes. They also help you to better understand the complex code you are working on. There are two main types of testing--unit testing and end-to-end (e2e) testing.

Unit testing is about testing isolated pieces of code. Unit tests normally use mocks for inputs and then assert that the expected results have occurred. The e2e approach executes tests against your application running in a real browser. Such tests assert that all pieces of code properly interact with each other. Standard test frameworks for Angular applications are Jasmine and Protractor. Jasmine is used for unit testing in combination with Karma-- a test runner for JavaScript. Protractor is an e2e test framework. This chapter describes two types of testing in a concise manner. You will learn how to set up and use the test frameworks efficiently. Testing and debugging tips round off the book.

In this chapter, we will cover the following topics:

  • Setting up unit testing with Jasmine and Karma
  • Unit testing of components and services
  • Tips on how to speed up unit testing
  • Setting up the e2e test environment with Protractor
  • Writing automated UI tests at a glance
  • Exploring an PrimeNG application with Augury and ng.probe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.125.51