This is an old revision of the document!
JUnit Testing in Project 3
Here are three JUnit classes to do unit testing on Project 3 classes WordNode
, WordList
, and HashList
.
To use these classes, download them to your Project 3 source directory and launch them as JUnit test classes.
For example, from the command line on Lore (or the MC cluster), you can use the javat
command located in the /homes/cs190m/student_bin
directory (which should be in your path). The javat
command is just a short shell script that sets the CLASSPATH
environment variable, compiles the given test class, and uses the JUnit TestRunner
class to run it:
#!/bin/sh CLASSPATH=".:/homes/cs190m/lib/junit-4.5.jar"; export CLASSPATH javac $1.java java junit.textui.TestRunner $1
To run these three tests, you would type (at the UNIX command line prompt):
javat WordNodeTest javat WordListTest javat HashListTest
These three test cases work (report no errors) on my version of Project 3, but I may have made some assumptions that you didn't. If you have questions, a suggestion, or find a mistake in this process, please send me email.