To effectively unit test a software component, it’s important to have a good understanding of how that component works. You can’t unit test something you don’t understand. Unit tests should be written so that they exercise only the specific parts of the code that are responsible for performing the desired task. This helps you isolate problems and make it easier to find them.
Unit testing also helps avoid regressions, which are unexpected changes in behavior caused by modifications to code after it is been tested but before it’s actually used in production. When you know that your code has been thoroughly tested and is stable, you can be more confident in making changes without worrying about causing unintended side effects in production.
You will Learn
- Write and structure unit & integration tests
- Remove side effects from tests via mocking and spies
- Write good tests and focus on testing core business logic
Automated testing is a key concept in modern (web) development.
Yet it is a concept that can be intimidating at first, hence many developers shy away from diving into testing and adding tests to their projects.
You will learn about the software and setup required to write automated tests and example projects will be provided as part of the course. It’s a hands-on, practical course, hence you won’t get stuck in theory – instead, you’ll be able to learn all key concepts at real examples.
In detail, this course will teach you:
- What exactly “testing” or “automated testing” is (and why you need it)
- What “unit testing” is specifically
- Which tools you need to enable automated unit tests in your projects
- How to write unit tests
- How to get started with integration tests
- How to formulate different expectations (assertions)
- Which patterns to follow when writing tests
- How to test asynchronous and synchronous code
- How to deal with side effects with help of spies & mocks
- How to apply all these concepts in real projects & examples