JMU CS345 - Software Engineering
Help Policies Solutions Study-Aids Syllabus Tools
Homework: Testing and Debugging


1 Purpose

The primary purpose of this assignment is to help you review (and demonstrate that you have acquired) the knowledge and skills required to test and debug software.

2 Overview

As you know from earlier assignments, SagaciousMedia is a (fictitious) company that develops educational hardware, software, and content for both the formal and informal education markets. To date you have written several components for their application named Gradient.

For this assignment, you must create unit tests for and debug a class that was written by SagaciousMedia. Specifically, you must create JUnit tests for WeightedAverageStrategy.java, identify the faults it contains, and correct those faults.

You must also correct any other defects in the WeightedAverageStrategy class. This includes, but is not limited to, style defects, incorrect/insufficient comments, "suspicious" constructs, code duplication, lack of clarity, etc.

3 Documents

Sagacious Media has created several new documents for this release.

4 Hints

The WeightedAverageStrategy class contains several faults. So, it should fail some of your tests. If it does not, improve your test suite.

For each failed test, understand the symptom and the trigger condition (i.e., stabilize the faults). Then, localize each fault, correct each fault (documenting the correction in the source code), and verify the correction.

5 Testing

You must use JUnit (v5) for testing. Your JUnit test suite need only cover the WeightedAverageStrategy class. Your tests must be in a package named testing and each test class must include the word "Test" in its name.

6 Submission

You must submit (using Gradescope) the necessary "old" classes and interfaces, the corrected WeightedAverageStrategy class, and your JUnit tests (for the WeightedAverageStrategy class only) in a file named sub7.zip. You must not submit any unnecessary classes or tests.

Because you should not be using Gradescope to verify your code, you may submit to Gradescope at most 10 times and you will not receive any hints from Gradescope about the official tests.

7 Grading

Your submission will be graded as follows:

Copyright 2025