Thinking about Testing, CSC430, Spring 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: (the one that accepts an index)
contains
get
indexOf
remove: (the one that accepts an index)
size
subList
For this project, you should start by cloning this GitHub repo.
3.1 Your Model
The first thing in your submission should be your model for a Java List. Specifically, you want to describe—in English—the contents of a java list in a "math-y" style that allows you to define later operations in terms of this model. You may not be sure what this will look like; start by putting down something simple. As you try to describe each method’s operation in terms of this model, feel free to come back and refine the model that you’ve written down, in such a way that the method’s operation can be described in terms of the model.
3.2 The Functions
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.