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.
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.
AverageSystem
class. Your tests must be in a
package named testing
and each test class must include
the word "Test" in its name.
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.
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