CS 257: Software Design

More books: unit tests for a class interface

Folder name: booksdatasource

Work with the same partner(s) you worked with for the first books assignment.

Relevant files

For your convenience, here are the files you'll need for this assignment.

Goals

Test-driven development

One purpose of this and the next couple assignments is to give you an introduction to test-driven development (TDD). Roughly, the process goes like this:

For us, the class will be called BooksDataSource, and its purpose will be to provide Python programmers with convenient access to the data in our books dataset.

The trick to writing good unit test suites is to think deeply about the many ways your interfaces might be called. Your tests should, for example, test typical cases, weird cases, and illegal cases. (For a really simple example, a unit test suite for a square-root function ought to include attempts to compute the square-roots of positive integers, positive non-integers, negative numbers, and zero, and depending on the language and the completeness of the interface specification, maybe the square-root of "moose" or other non-numerical input.) You should think hard about the mistakes programmers can make, the bad data users can generate, and the ways malicious programmers might try to exploit errors or omissions in your code.

Your job

A few notes

Good luck

Start early, ask lots of questions, and have fun!