Angular is one of the main frameworks for building web applications. While not completely “unit testing”, testing web components in isolation has the benefits of quick feedback and confidence in quality. In this packed 1-day intro, we’ll learn how to test Angular components.
In this 1-day hands-on workshop, we’ll introduce Angular component testing, with Jest and the Angular Testing library (or Test Bed), and use them for isolated component testing in JavaScript / TypeScript. Attendees will practice the needed techniques to write, plan, design and write tests for components.
We’ll see how to write, run, and debug component tests. We’ll go over elements and expectations and talk about the async and dynamic aspects of the operations.
On top of that, we’ll discuss where component tests fit into testing work – How they fit within web and unit tests, and when they can be replaced with simpler tests. We’ll also see how to run the tests in CI environment.
The exercises are in JavaScript / Typescript. Attendees will download the exercise from GitHub before the session starts.
Workshop total length: 1 day
Remote and on-site options.
Audience
The workshop is intended for front-end, full-stack developers and team leaders.
Workshop goals
Following the workshop, attendees will be able to:
- Describe the benefits and challenges of component testing
- Plan and design the component tests.
- Design Angular component code to be testable and easy to change.
- Write and debug components using the Angular Testing Library / Test Bed.
- Mock external calls
- Run the tests in Continuous Integration systems
Workshop agenda
- The place of DOM component tests in testing
- Testing Angular components
- Testability and Single Component Angular Modules (SCAMs)
- Querying elements
- Using the Jest-DOM assertions
- Using User-Event library to invoke events
- Testing event invocation
- Debugging tests
- Mocking external API calls at function levels
- Handling async code scenarios
- Running in Continuous integration system
Prerequisites
- Basic understanding of test automation and test frameworks
- Angular development knowledge
- Attendees need a laptop with an IDE with toolset (e.g. VS Code, node, npm).
For more questions:
Contact Us!