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 an earlier assignment, perspecTV is a (fictitious) company that designs, creates and markets products that provide a new perspective on television. Their products make television both more interactive and more informative. They are in the process of developing a suite of products called forScore for judged competitions of various kinds (e.g., sporting events like diving and gymnastics, singing contests, dance competitions).

For this assignment, you must create unit tests for and debug a class that was written by perspecTV. Specifically, you must create JUnit tests for AverageSystem.java (which was written by someone at perspecTV), identify the faults it contains, and correct those faults.

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

3 Starting Point

This assignment builds on (some parts of) H5. You may start with either your solution to those assignment or mine. However, there is no guarantee that my code is correct; you are responsible for any and all mistakes in your submission.

4 Documents

perspecTV has created several new documents for this release.

5 Hints

You should start by creating a significant number of black/closed box tests, and enough white/open box tests to completely cover your code. You should then test the existing implementation of the AverageSystem class.

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

The AverageSystem class contains several faults. So, it should fail some of your tests. If it does not, improve your test suite. This will most likely involve creating more black/closed box tests, but may also involve the creation of more white/open box tests.

6 Testing

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

7 Submission

You must submit (using Gradescope) the necessary "old" classes and interfaces, the corrected AverageSystem class, and your JUnit tests for the AverageSystem class, in a .zip file (packaged appropriately). Do not submit extraneous files (e.g., classes that aren't needed and/or tests that aren't needed) and do not use the DivFileReader. You may submit to Gradescope at most 5 times and you will not receive any hints from Gradecope about the official tests.

This is a significant departure from previous assignments. On previous assignments I allowed you to use Gradescope as a testing tool, even though you were supposed to be testing your code yourself. I did so because we had not yet discussed testing and debugging. Now we have, and you are completely responsible for testing (and debugging).

To that end, you should now think of Gradescope only as a tool that I use for grading your submission, not as a tool that you use for testing. In other words, your job is to test and debug the code, my job is to grade how well you did, and I am using Gradescope to help me. This means that I could (indeed, should) allow you to submit only once, and you should submit only when you are sure that the code is free of defects. I would then grade your submission (with the help of Gradescope) and tell you how you did. However, since that would cause enormous amounts of stress and complaining, I am allowing you a few submissions so that you can correct problems you might have with the submission process itself (e.g., submitting the wrong files, structuring the .zip file incorrectly). Hence, Gradescope will not provide you with any hints. (Actually, Gradescope may sometimes provide a hint, but it is intended for me, not for you, and in no way is it intended to be a complete list of the defects in your submission.)

If you are very confident that your code conforms to the style guide, passes your tests, and that your tests cover your code but Gradescope is telling you otherwise, then you should feel free to contact me. However, you must be very confident before you do so.

To ensure that you are submitting all of the classes you need, but no extraneous classes, you should probably create a new project in Eclipse and copy files into it one at a time (starting with the AverageSystem class) as needed.

8 Grading

Your submission will be graded as follows:

As always, points will be deducted manually for code that is unclear, inelegant, and/or poorly documented. In addition, points will be deducted if you do not have a sufficient number of black box tests, regardless of whether or not your tests cover the code. Some of your black box tests should involve random inputs, and some should involve inputs that were generated using appropriate rules of thumb.

Copyright 2024