Adding Software Testing to Programming Assignments

Adding software testing to programming assignments has many benefits, but many educators don't know where to start. This tutorial will show you how.

This tutorial provides a practical introduction to how one can incorporate software testing activities as a regular part of programming assignments, supported by live demonstrations, with a special focus on early introduction in CS1 and/or CS2 courses. It presents five different models for how one can incorporate testing into assignments, provides examples of each technique, and discusses the corresponding advantages and disadvantages. The focus is on unit testing, test-driven development, and incremental testing, all of which work well in a classroom environment. Examples will use Java, although participant discussion regarding support in other languages such as Python and C++ is welcome. Approaches to assessment--using testing to assess student code, assessing tests that students write, and automated grading--are all discussed. A live demonstration of automatic assignment grading based on student-written tests is included. Advice for writing "testable" assignments is given. Participant discussions are encouraged.

If you wish to get started with software testing in your assignments (for Java especially), the following materials will help you on your path:

Make sure you have set up your own environment for using JUnit if you want to try out some of the examples posted here on your own later.

Adding Testing to Assignments Discussion Forum: we have an on-line forum set up (use Facebook Connect to login, or create an account) on the Web-CAT web site for you to ask questions, discuss ideas, and share with each other; feel free to use it before, during, and after the tutorial.

JUnit Discussion Forum: there is also a similar forum specifically focused on JUnit questions and issues; feel free to use it as well.

Presentation: Adding Software Testing to Programming Assignments (PDF, 14 pp.)

The examples shown in the tutorial: