Mocks and Stubs: Test Doubles with Mockito

Mocks and Stubs: Test Doubles with Mockito

Step by step guide to Mocks, Stubs, and Mockito. Includes hands-on exercises for each topic.

Mocks are special case objects that simulate real objects for testing. Mocks help you write Unit Tests for complex, interconnected components, modules, and services.

This course teaches you everything you need to know about testing complex services with test doubles (Mocks and Stubs) in a way that is simple to understand. The course constitutes of videos, hands-on exercises, and scenarios that guide you in the right direction and help you learn by doing things on your own. Lectures are focused on building your knowledge intuitively so that it’s easier to transition this knowledge into real-world solutions.

The course covers the in-depth exploration of various topics like what are test doubles, mocks, stubs, the mockito library, testing errors with mocks, and is designed keeping in mind real-world applications of Mocks. These tools and techniques are used by large organizations to test production-grade applications with over a million lines of code!

About the teaching Style: 
This course uses Socratic learning techniques, where you learn by actually solving coding assignments. It is structured in a way that you can do the first few chapters, and gain enough practical knowledge to apply it to a project. The coding assignments give you the confidence to directly use this knowledge during your job or your college.

If you already know a bit about Mocks and Stubs:
If you already know a bit about mocks and stubs, you might still benefit from this course. Just do the exercises, and watch the solution videos to verify. Make sure you watch the last video on next steps.

What you’ll learn?
  • Why do we need test doubles (mocks and stubs)?
  • Understand how the behavior of an object can be verified using mocks
  • Understand how interaction with an object can be simulated using stubs
  • Learn how to create mocks using Mockito
  • Test errors and exception scenarios using Mocks and Stubs
Who is this course for?
  • Developers working on complex codebases looking to unit test complicated, interdependent pieces of code
  • Developer who have learned the basics of unit tests and want to gain an intermediate-level understanding of unit testing
  • Developers who know a little bit about mocks and stubs, but want to understand the topic in more detail
  • Hands-on programming experience
  • Working knowledge of a unit testing framework such as JUnit or Jest
  • Experience writing unit tests for functions of intermediate complexity
  • Working knowledge of git, and a GitHub account
Course content
1. Introduction to Test Doubles
1. Overview – Mocks and Stubs
5. How To Use This Course
2. Setup and Overview
2. Project Overview
3. The First Test Double
1. Writing the First Test
2. Assignment – Make The Test Pass
4. Solution – Test Doubles for Dependencies
4. Intro to Mocks
1. Assignment Complete the First Test
3. Solution The First Test with Mocks
5. Intro to Stubs
1. Assignment Testing Complex Methods
3. Solution Testing with Stubs
6. Testing Exceptions in Dependencies
1. Assignment – Errors in Dependencies
3. Solution – Stubs with Exceptions
7. Mocking Libraries – Mockito
1. Intro to Mockito
2. Assignment – Test Doubles with Mockito
4. Solution – Test Doubles using Mockito
8. Wrap Up and Next Steps
1. Wrap Up and Next Steps
Download all files and links used in the course from here | Password: