Course duration
- Custom Length
Course Benefits
- Learn how to use both synchronous and asynchronous tests with Angular components, pipes and services.
- Learn to write tests that include Angular routing and incorporate spies and mocks.
Course Outline
- Unit testing in Jasmine
- Software Testing
- Types of tests
- Test Pyramid
- Unit Tests
- Jasmine, Karma and Angular
- Jasmine
- Karma
- Basic Terminology
- Test Suite
- Spec
- Assertion
- Matchers
- Setup and Teardown
- A Test Suite
- Auto-Generated Angular Test Suites
- Run a Test
- Summary
- Jasmine Configuration
- Setup and Teardown
- Setup/Teardown Example
- Order of Execution
- Nested Test Suites
- Nested Test Suites Order of Execution
- Nested Setup/Teardown Order of Execution
- Custom Matchers
- Interface
- Matcher Factory
- Use the Matcher
- Run the Tests
- Disabling Suites and Specs
- The this Keyword
- Summary
- Testing - Components, Pipes and Services
- Testing Components
- Testing the Class Only
- Example Component
- Test Component Class
- Test Component Class Example
- Test Component
- Test Component Example
- TypeScript async/await
- Change Detection
- DOM Element(s)
- Testing Pipes
- Pipe Class Example
- Pipe Spec Example
- Testing Services
- Service Class Example
- Service Spec Example
- Expecting an Error
- Summary
- Testing – DOM, Routing and Code Coverage
- Testing in Angular
- Components
- Testing the DOM
- DOM Testing vs End-to-End Testing
- TestBed
- TestBed Use Cases
- Using TestBed
- ComponentFixture
- Get the Component and DOM Element
- Selecting DOM Elements with NativeElement
- Selecting DOM Elements with DebugElement
- Selection Examples
- Accessing Text
- Button Clicks
- Routing
- Routing Test Setup
- Routing Spec
- Code Coverage
- Detailed Coverage Summary
- Details
- Summary
- Integration Testing
- Integration Testing
- Spies
- Service Class Example
- Spec
- Using a Spy to Return a Fixed Value
- Using a Spy to Return a Dynamic Value
- Injection
- Injection Example
- Injection in a Test Suite
- Mocks
- Summary
Class Materials
Each student will receive a comprehensive set of materials, including course notes and all the class examples.
Experience in the following is required for this Angular class:
- Experience with Angular
Courses that can help you meet these prerequisites:
Instructor-led courses are offered via a live Web connection, at client sites throughout Europe, and at our Geneva Training Center.