Mocks and Stubs: Test Doubles with Mockito
Mocks, Stubs, and Mockito: A step-by-step guide to how they all work together. Each topic has hands-on activities that you can do.
What you’ll learn
Mocks and Stubs: Test Doubles with Mockito
- We need test doubles (mocks and stubs) because we want to be able to run tests.
- Understand how mocks can be used to test the behaviour of an object.
- Understand how stubs can be used to simulate how an object interacts with you.
- Learn how to make mocks with Mockito.
- Using Mocks and Stubs, you can test for errors and exceptions.
Requirements
- Hands-on experience with programming.
- People who know how to use a unit testing framework like JUnit or Jest.
- Experience with writing unit tests for middle-level functions.
- Working knowledge of git and a GitHub account is needed to be able to work with this tool.
Description
Mocks are special objects that can be used to test things that aren’t real. Mocks help you write Unit Tests for complex, interconnected parts, modules, and services. They make it easier to write Unit Tests for them.
Using test doubles, like mocks and stubs, to test complex services is what this course is all about. You will learn everything you need in an easy-to-follow way. There are videos and hands-on exercises in the course that show you where to go and help you learn on your own.
The course goes over a lot of different things, like what are test doubles, mocks, stubs, the mockito library, and how to test errors with mocks.
If you work for a big company, you can use these tools and techniques to test production-quality apps with over a million lines of code.
If you know a little about Mocks and Stubs:
There may still be value in this course even if you know a little about mocks and stubs. Do the exercises, and then watch the videos to see if they work. If you haven’t seen the last video, don’t forget to.
Who this course is for:
- It’s a goal of developers who work on complex codebases to unit test complicated, interdependent pieces of code.
- It’s for people who have already learned the basics of unit tests and want to learn more about unit testing at a more intermediate level.
- Developers who already know a little about mocks and stubs but want to learn more about them.