View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

Barbara Fox

JUnit Testing with drJava




As homework for the 2008 AP Workshop with Barbara Ericson, we were asked to create several teacher resources. I decided to focus on programming assignments and "doing them right" (whatever that means!) In my case this meant creating pre-built tests to check the programs (using JUnit), and self-documenting code using Javadoc. Both of these are new topics for me, but I think will be invaluable in the classroom. I have included 4 different programming folders to meet the requirements of 4 assessments. WhileAndIf teaches how to use JUnit to test code. WhileAndIf-BadCode is the same code with a logic error, showing how JUnit reports the problem. ArrayExample assesses processing arrays AND how to properly document using Javadoc (see below). A JUnit testclass is supplied called TestArrayExample. BankAccount creates a BankAccount object and allows deposits and withdrawals to the account. A JUnit test called TestBankAccount exercises a few methods.



To get an idea of what is included in the zip file, read this Readme file: Readme.html It contains descriptions of how to use JUnit and Javadoc along with directions on how to use my code. (Please note there are 2 screendumps at the bottom of the Readme that will not display from clicking on this link. When you unzip the zip file, the Readme file contained there will work properly.)


Here is a zip file containing all the necessary folders, subfolders, requirements for the programs, and solutions including JUnit tests.
JUnitTests-FundamentalsOfJava.zip Just put it in any folder, unzip it, and open up the top level Readme.htm to get started.

Barbara Fox
bfox@ncchristian.org
Kennesaw, Georgia

Link to this Page