Unit Testing in Java Course

Go to class
Write Review

Free Online Course: Unit Testing in Java Course provided by Treehouse is a comprehensive online course, which lasts for 2-3 hours worth of material. The course is taught in English and is free of charge.

Overview
  • Unit testing is a Java best practice that ensures your code is working how it was intended. It is a critical habit that you should develop early on in your coding adventures.

    What you'll learn

    • Defining a Unit
    • Composition vs. Inheritance
    • Test fixtures, test suites and the jUnit test runner

Syllabus
  • Why Test?

    Testing is a critical development practice. It provides countless benefits that we will explore.

    Chevron 9 steps
    • Introduction

      5:10

    • Defining a Unit

      3:34

    • How we define units

      3 questions

    • Introducing the Project

      4:59

    • Beginning the Project

      3 questions

    • Code Reuse

      6:12

    • Composition vs. Inheritance

      4 questions

    • The Quick Prototype

      6:56

    • Single Responsibility Principle

      2 questions

    How to Test

    Let's get our testing environment all set up and walk through how to write and then run our tests.

    Chevron 8 steps
    • Meet JUnit

      2:56

    • Setting Up a Project for Tests

      10:22

    • Running Tests and Reading Output

      3:55

    • JUnit basics

      3 questions

    • Assertions

      7:44

    • Single Assertions Make For Better Tests

      1 objective

    • Fixtures

      4:44

    • Using Before to not repeat yourself

      1 objective

    What to Test

    Determining what to test is part of the great art of testing. Let's explore the boundaries and responsibilities of your tests.

    Chevron 10 steps
    • The Happy Path and Beyond

      7:40

    • Exceptions

      6:53

    • Happy Path Exception

      1 objective

    • Know Your Bounds

      12:41

    • Rules rule!

      1 objective

    • Ruler of rules

      1 objective

    • What Not To Test

      9:37

    • To Test or Not To Test

      4 questions

    • @AfterClass

      1:46

    • Test the running total

      1 objective