Thinking about Testing, CSC430, Winter 2023
1 Goal
Develop a test suite for an unspecified List implementation in Java.
2 Explanation
Test suites are generally used as a means to verify that implementations are correct. However, it’s often the case that test suites are constructed after the fact, for a specific implementation.
In this assignment, we’re asking you to assemble a generic test suite for Java’s List interface (okay actually just a part of it), without reference to a specific list implementation.
3 The List Interface
Here’s a link to Oracle’s specification of the List interface in Java. Take a look at it; hopefully, it looks somewhat familiar.
For this assignment, we’re only going to be considering the following methods from this interface:
add
contains
get
indexOf
remove: (the one that accepts an index)
size
subList
For this project, you should start by cloning this GitHub repo.
The idea is that for each of the functions listed, you should do the following things:
Do your best to specify, in English, as a comment, the "correct" behavior for this method. You should do so in such a way that you stymie an adversarial implementor, who is doing to do their best to construct an implementation that matches your specification but is totally broken and useless.
Write one or more tests that you think do a reasonable job of testing that the list implementation performs according to the specification.
The given file contains the beginnings of such a structure for the size method.
Feel free to go over your english specification after writing your tests, if you feel it can be specified more precisely.
4 Handin
This feels pretty janky, but let’s just use the same handin server for this assignment that we’ve used for previous ones.
Specifically, do all of your work in the ListTests.java file. When you’re done, open the file in DrRacket and use the "CSC 430 Handin" button to submit it as assignment 7.