Introduction to Test Driven Development (TDD)

About this Course

Successful developers need to not only build the right software but build it right. To know your software works correctly, you need to test each unit of code. One of the best methods for this unit-level testing is test driven development.

This course provides a detailed overview of test driven development (TDD). First, you’ll learn what automated testing is and why it is essential for building robust applications resilient to failure. You’ll explore the basics of testing, including test cases, testing levels, and the traditional release cycle. You’ll learn about TDD and its complement, behavior driven development (BDD): TDD tests individual units of code while BDD tests how these units work together. Then you’ll examine TDD in detail. You’ll explore TDD’s benefits, concepts, and popular tools, and you’ll hone your new testing skills through hands-on labs. You’ll create TDD test cases by writing test assertions and building test fixtures, and you’ll run these test cases by using the Nose testing package. You’ll then practice more advanced TDD methods such as increasing code coverage, generating and using fake data, and testing mock objects.

This course is part of multiple programs

This course can be applied to multiple Specializations or Professional Certificates programs. Completing this course will count towards your learning in any of the following programs:

  • IBM DevOps and Software Engineering Professional Certificate
  • IBM Applied DevOps Engineering Professional Certificate

WHAT YOU WILL LEARN

  • Explain the importance of testing 
  • Describe test-driven development (TDD) and explain its benefits for DevOps
  • Develop unit tests with test assertions and test fixtures and then run the tests
  • Improve unit testing through advanced TDD methods including coverage reports, factories, fakes, and mock objects

SKILLS YOU WILL GAIN

  • Test Case
  • Software Testing
  • Behavior-Driven Development
  • Automated Testing
  • Test-Driven Development

Syllabus – What you will learn from this course

WEEK1

1 hour to complete

Introduction to Testing

This module provides an overview of software testing. You will learn about the importance of testing through an example: the development of the Apollo 11 Lunar Module’s guidance system. You will discover the numerous problems that occur when developers do not test their code. Then you will explore the four levels of testing and find out when each appears in the traditional release cycle. You will learn what test driven and behavior driven development are and why both are essential for effective testing. You will discover the purpose of test cases and witness their value through a demonstration.

6 videos

  • Course Introduction3m
  • The Importance of Testing8m
  • Why Developers Don’t Test 3m
  • Testing Levels and Release Cycle5m
  • TDD and BDD4m
  • Testing Case Study8m

2 readings

  • Course Introduction2m
  • Summary & Highlights 2m

2 practice exercises

  • Practice Quiz: Introduction to Testing15m
  • Graded Quiz: Introduction to Testing30m

WEEK2

4 hours to complete

Introduction to Test Driven Development

This module provides an overview of test driven development (TDD). You will learn what TDD is and discover the three basic steps in the TDD workflow, also known as the Red/Green/Refactor workflow. You will find out why TDD is important for DevOps and all automated testing. You will also discover popular testing tools for TDD and closely examine the features of several such tools for Python. This module also covers essential methods for performing TDD. You will explore two ways to run TDD tests: Python’s built-in test runner called unittest and the more feature-rich module called Nose. You will learn what assertions are and how to use them to test code. You will discover why you need to include both happy and sad paths in your test module. You will also find out what test fixtures are and how to use them to establish an appropriate initial state for each test.

9 videos

  • Benefits of Test Driven Development4m
  • Tools for TDD 4m
  • Running Tests with Nose3m
  • Running Tests with Nose Demo 8m
  • Anatomy of a Test Case7m
  • Writing Test Assertions 8m
  • Writing Test Assertions Demo13m
  • Test Fixtures7m
  • Creating Initial State Using Test Fixtures Demo 15m

2 readings

  • Summary & Highlights2m
  • Summary & Highlights 2m

3 practice exercises

  • Practice Quiz: Introduction to Test Driven Development15m
  • Practice Quiz: Methods for Test Driven Development21m
  • Graded Quiz: Methods for Test Driven Development30m

WEEK3

5 hours to complete

Advanced Methods for Test Driven Development

This module covers advanced methods for TDD. You will learn about test coverage: why it’s important, how to increase it by using test coverage reports, and why you should keep testing even at full test coverage. You will discover the value of testing against fake data and how to use factories to generate this data. You will also explore mocking, a process for mimicking the behavior of real objects, and you will find out the testing situations for which mocking is useful. You will learn how to use two common methods for mocking: patching a function call and mocking entire objects.

10 videos

  • Test Coverage 7m
  • Running Test Cases with Coverage Demo 18m
  • Factories and Fakes9m
  • Factories and Fakes Demo 17m
  • Mocking 4m
  • Mocking with Patch9m
  • Mocking with Mock Objects9m
  • Mocking with Mock Objects Demo16m
  • Practicing Test Driven Development5m
  • Practicing Test Driven Development Demo15m

1 reading

Summary & Highlights2m

2 practice exercises

  • Practice Quiz: Advanced Methods for Test Driven Development15m
  • Graded Quiz: Advanced Methods for Test Driven Development30m

WEEK4

1 hour to complete

Final Exam and Course Wrap-Up

2 readings

  • Congratulations & Next Steps3m
  • Team & Acknowledgements1m

1 practice exercise

Final Exam45m

Leave a Reply

Your email address will not be published. Required fields are marked *