Software engineeringLesson 2 of 2 in the course Testing and maintenance

Unit Testing: Test Design, TDD, and Practical Limits

5 flashcards · 5 quiz questions · 5 match pairs · 5 fill-in sentences · English

Lesson progress
0 / 5

Your progress is kept in this browser only.Sign up to save it

Summary

Unit testing checks isolated parts of software to see whether they behave as expected. This lesson introduces the purpose of unit testing, how the practice developed, and what counts as a unit.

Unit testing, also called component or module testing, tests isolated source code to validate expected behavior. It focuses on a small portion of a system rather than testing the system as a whole.

All flashcards

What is a unit in unit testing?
A single behavior of the system under test, usually tied to a requirement and exposed through an entry point.
How do unit, integration, and system testing differ?
Unit testing checks isolated behavior, integration testing checks combined components, and system testing examines the complete system.
What is a parameterized test?
A test that runs the same steps with multiple sets of input values.
What is a test double?
A substitute used in a test in place of a real dependency.
What is the purpose of an executable specification?
To express expected behavior in a test that can be run against an implementation.

Quiz questions

  1. Which sequence describes the basic test-driven development cycle?Answer: Write a failing test, implement enough to pass it, then refactor.
  2. What does a passing set of unit tests establish?Answer: The tested cases met their criteria; untested behavior may still contain defects.
  3. Why can version control help when a previously passing test begins to fail?Answer: It can help identify changes made since the last successful run.
  4. What is a primary role of an automated testing framework?Answer: To organize and run tests and report failures.
  5. Why are integration tests still needed when unit tests use a database test double?Answer: The double may not reproduce the real database's behavior or verify the actual connection.

Based on the Wikipedia article Unit testing, licensed CC BY-SA 4.0. Adapted into a summary, flashcards and quizzes.

All Software engineering lessons