Automated tests are an important ingredient in a successful project. This course will teach you everything you need to know to unit test your Angular projects, including testing services, component templates, and dealing with asynchronous code.
Angular gives us an amazing set of tools to help us unit test our code, but all those tools and techniques need to be learned. In this course, Unit Testing in Angular, you will learn how to effectively unit test your Angular code. First, you will learn to write isolated tests to quickly and easily test services, pipes, and components. Next, you will explore integration tests, used to test your components with their templates. Then, you will see how to deal with advanced topics like asynchronous code. Finally, and most importantly, you will know what it means to write effective, maintainable unit tests. When you are finished with this course, you will feel confident in your ability to write good unit tests for your Angular projects.
Joe has been a web developer for the last 13 of his 16+ years as a professional developer. He has specialized in front end and middle tier development . Although his greatest love is writing code, he also enjoys teaching and speaking about code.
Shallow Integration Tests Hello, I'm Joe Eames, and welcome to this module on Shallow Integration Tests. Integration tests let us test not only a component, but its template as well. This could be a huge benefit when working to assure that your components actually do what they're supposed to do. In this module we will be learning how to do integration tests with Angular, which gives us a way to test a component with its template. We'll start by looking at the TestBed, which is the main testing tool provided by Angular. After that, we'll look at how to ignore child directives in our shallow integration tests, then we'll look at how to test out templates, which is the core reason for writing integration tests. Finally, we'll look at how to deal with child components and directives, instead of ignoring them.
Deep Integration Tests Hello, I'm Joe Eames, and welcome to this module on deep integration tests. In this module we will be learning how to do deep integration tests, which gives us a way to test our components with their live children. We'll start by jumping right into writing a deep integration test. This will not be too much more difficult than what we've actually been doing with our shallow integration tests. Then we'll see a technique for locating child directives, and finally, we'll take a bit of time looking at how to use integration tests with services to get some unique benefits.
Testing DOM Interaction and Routing Components Hello, I'm Joe Eames, and welcome to the module on Testing DOM Interaction and Routing Components. In this module we'll start by looking at how to trigger events in our components. We'll actually look at three different methods for accomplishing this in a test. After that we'll see how to interact with input boxes. And the final thing we'll cover in this module is routing components. We'll look at dealing with two aspects here. First, we'll see how to test components that use the activated route service and then we'll look at testing components that use the RouterLink directive, and how to test that they are set up correctly.
Advanced Topics Hello, I'm Joe Eames, and welcome to the module on Advanced Topics. We'll cover two main topics in this module. First, we'll see how to deal with asynchronous code in our tests. With observables in Angular this isn't as common of a need as it used to be, but it can still come into play. Second, we'll see how to use the CLI to generate code coverage reports. Both of these techniques can be very valuable if used appropriately.