Skip to content
Software Engineering Principles · Term 4

Quality Assurance and Testing

Implementing unit tests, integration tests, and debugging strategies to ensure robust code.

Need a lesson plan for Computer Science?

Generate Mission

Key Questions

  1. How does Test-Driven Development change the way a programmer approaches a new problem?
  2. What is the difference between a bug that is a logic error and one that is a runtime error?
  3. Can a software product ever be 100 percent free of defects?

Ontario Curriculum Expectations

CS.SE.9CS.P.25
Grade: Grade 12
Subject: Computer Science
Unit: Software Engineering Principles
Period: Term 4

About This Topic

Quality assurance and testing ensure software reliability through systematic checks. Grade 12 students implement unit tests for individual functions, integration tests for module interactions, and debugging strategies like breakpoints and logging. These methods connect to software engineering principles, where robust code prevents failures in real-world applications such as banking systems or medical devices.

Students explore Test-Driven Development, writing tests before code to guide solutions. They differentiate logic errors, which yield incorrect results without crashing, from runtime errors that halt execution due to issues like division by zero. Class debates on whether software can be defect-free highlight the role of ongoing testing in managing risks.

Active learning excels in this topic because students code, test, and debug in real time. Pair programming TDD exercises let them iterate quickly, while group bug hunts reveal error patterns. These hands-on cycles make abstract strategies concrete, boost problem-solving skills, and mirror professional workflows.

Learning Objectives

  • Design unit tests for given code functions using a specified testing framework.
  • Integrate multiple code modules and write integration tests to verify their interactions.
  • Compare and contrast the effectiveness of different debugging strategies, such as breakpoint debugging and logging, for identifying specific error types.
  • Evaluate the impact of Test-Driven Development on code quality and development time for a small project.
  • Classify identified software defects as either logic errors or runtime errors, providing justification for each classification.

Before You Start

Functions and Methods

Why: Students need to understand how to write and call functions to be able to test them individually.

Basic Programming Constructs (Variables, Loops, Conditionals)

Why: Understanding fundamental programming logic is essential for identifying and debugging errors.

Key Vocabulary

Unit TestA small, isolated test designed to verify the correctness of a specific piece of code, such as a single function or method.
Integration TestA test that verifies the interaction and communication between different modules or components of a software system.
Test-Driven Development (TDD)A software development process where developers write automated tests before writing the functional code, using the tests to guide development.
DebuggingThe process of finding and resolving defects or problems within a computer program that prevent correct operation.
Logic ErrorA bug in a program that causes it to produce incorrect or unexpected results, but does not cause the program to crash or terminate.
Runtime ErrorAn error that occurs during the execution of a program, often causing the program to terminate unexpectedly.

Active Learning Ideas

See all activities

Real-World Connections

Software engineers at Google use extensive unit and integration testing to ensure new features in Android or Chrome are stable before release to millions of users.

Quality assurance testers at Electronic Arts employ debugging tools and test plans to identify and fix bugs in video games like FIFA or Madden, ensuring a smooth player experience.

Financial institutions like RBC or TD Bank rely on rigorous testing, including TDD, to guarantee the accuracy and security of their online banking applications, preventing costly errors.

Watch Out for These Misconceptions

Common MisconceptionTesting happens only after all coding finishes.

What to Teach Instead

Test-Driven Development requires tests first, which clarifies requirements early. Active pair exercises show students how this prevents scope creep and catches issues sooner than end-stage testing.

Common MisconceptionAll bugs are syntax errors easy to spot.

What to Teach Instead

Logic and runtime errors often hide deeper. Group debugging challenges help students trace execution flows collaboratively, building skills to isolate subtle issues beyond compiler alerts.

Common MisconceptionComprehensive testing guarantees bug-free software.

What to Teach Instead

Infinite inputs mean exhaustive testing is impossible. Class simulations of test coverage gaps teach students to prioritize risks, fostering pragmatic quality assurance mindsets.

Assessment Ideas

Quick Check

Provide students with a simple, buggy function. Ask them to write one unit test that would fail due to the bug and then describe the debugging step they would take to find the error.

Discussion Prompt

Pose the question: 'Can software ever be 100 percent defect-free?' Facilitate a class discussion where students use examples from real-world software failures to support their arguments, referencing concepts like testing limitations and complexity.

Peer Assessment

Students pair up and exchange code snippets they have written. Each student reviews their partner's code, identifying potential bugs and suggesting one specific unit test they would write to catch a hypothetical error. Partners provide feedback on the clarity and relevance of the suggested tests.

Ready to teach this topic?

Generate a complete, classroom-ready active learning mission in seconds.

Generate a Custom Mission

Frequently Asked Questions

What is Test-Driven Development in software engineering?
Test-Driven Development cycles through writing a test that fails, coding the minimum to pass it, and refactoring. For Grade 12, start with simple functions like string validators. This method sharpens problem decomposition and produces cleaner, more modular code from the outset.
How do logic errors differ from runtime errors?
Logic errors produce wrong outputs without crashing, like miscalculating averages due to faulty loops. Runtime errors, such as null pointer access, halt programs. Students practice by injecting both into sample code, running tests to classify and fix them.
Can software ever be completely free of defects?
No, due to complexity, changing requirements, and human factors. Aim for high coverage and rapid fixes instead. Discuss real cases like Heartbleed to show even rigorous testing misses some issues, emphasizing continuous integration.
How does active learning support teaching quality assurance and testing?
Active approaches like live coding TDD in pairs or group debug relays immerse students in the full cycle. They witness tests failing and passing, collaborate on fixes, and reflect on strategies. This builds intuition for when tests add value, far beyond passive demos, and prepares them for team-based development.