Roy Osherove: The art of Unit Testing in Java

Online Masterclass
Roy Osherove
Roy Osherove

Author of "The Art Of Unit Testing" and "Elastic Leadership: Growing Self-Organizing Teams"

The Problem

Unit testing, done badly, can hurt your project more than it helps. In some cases, it may lead to project schedule delays, and unhappy developers due to huge maintenance problems. But when unit testing is done right, it can help the project and developers’ confidence immensely.

The challenge is - how do you do it in a way that is helping, rather than hurting your project?

Objective

In this masterclass, we will learn essential test-driven skills and techniques for writing unit tests in a readable, maintainable, and trustworthy fashion, so that we can feel more confident in our code, make it simpler, and save ourselves time in debugging and maintaining our code base. We will also look at some code design issues that hurt testability.

  • Learn how to write readable, maintainable, trustworthy unit tests using Java, JUnit, and other unit testing tools and frameworks.
  • Learn how to refactor and test legacy code, and what to do when we cannot change existing code.
  • Learn the principles of Test Driven Development, and develop new features using TDD.
  • Learn how to Pair Program, and experience it throughout the course
  • Learn about mocks, stubs fakes, and the difference between them
  • Learn about Isolation(mocking) frameworks, how they work, and why some frameworks are more capable than others

Agenda - Day 1: Beginnings

  • What is the “unit” in “unit testing”? A discussion about unit of work.
  • The first unit test
  • Basic JUnit APIs, test runners, tips and tricks
  • Writing readable tests
  • Test-Driven Development Introduction
  • String Calculator Kata Exercises
  • Value base, State-Based and Interaction Based Tests
  • Understanding Fakes, Mocks, and Stubs
  • Hand Written Fakes, Stubs, and Mocks

Agenda - Day 2: Mock Objects and Stubs

  • Isolation Frameworks: Constrained and Unconstrained
  • Isolation Framework Comparisons
  • Exercises
  • Unit Testing Best Practices
  • Code Review Exercises
  • Refactoring Exercises:
  • Faking Time
  • Extract And Override
  • Introduce Instance Delegator

Materials

All students get a PDF of all the slides in the course, in a downloadable form.

Related

EVENTS

Software Architecture for Developers

Software Architecture for Developers

Thu. Apr 15 2021, 09:00

GOTO Academy Amsterdam

Software Architecture in the 2020s

Software Architecture in the 2020s

Wed. Mar 10 2021, 15:00

Zoom

Ask Me Anything with Dave Karow

Ask Me Anything with Dave Karow

Wed. Feb 3 2021, 16:00

Slack

Software Engineering in 100 Years Time

Software Engineering in 100 Years Time

Thu. Nov 5 2020, 18:00

Zoom

View all events
here