SAINT MARY'S UNIVERSITY
Department of Mathematics and Computing Science
CSC 465.2
Object-Oriented Programming
2003 Winter Term 2003
Team Project
JUnit is a java testing framework written by
Erich Gamma and Kent Beck. It is used by the developer
to ensure an efficient and stable programming style.
Background and Introduction
Junit is a framework that provides you with a simple way to explicitly test specific areas of java programs.
Using a framework like juint for testing programs can be very beneficial, because you must declare the expected
results of the program being tested and compare those with the actual results. This lets you debug your program
until you get those expected results. It also makes it possible to immediately see the effects of modifications
you make to your program. Junit promotes the idea of first testing and then
coding, which some programmers believe can increase the productivity and the
stability of the program. Our project will focus
on how to use junit to its full potential by demonstrating sample programs and
finishing off with tests on our own mastermind game.
Timeline
Things to do ...
|
Complete by |
Notes and Comments
|
Develop test classes for junit testing. Compile these programs and run them with junit. Pay close attention to the classpath needed for compiling.
|
Jan 30, 2003
|
Compiling programs with file types of
.jar is not the same as when you are dealing with packages. Determine the command necessary to accomplish this.
|
Find/develop junit testing programs to include as examples into our tutorial website.
|
Feb 7, 2003
|
We'll have a few sample programs on our site before introducing our tests made on our mastermind program.
|
Create a partially completed tutorial website to get the final approval on our project allowing us to proceed further.
|
Feb 12, 2003
|
Here is a link to our tutorial website,
It is recommended to use Internet Explorer:
JUnit Tutorial
|
Complete the following:
- Software Development Notes
- User Guide
- Software Availability
- References
|
April 9, 2003
|
Ensure all links are working properly and the content is correct.
|
Software Development Notes
Here is a list of problems and solutions we have encountered
through our research:
-
Compiling errors: make sure the "import junit.framework.*;"
is included in your program and when compiling the program into byte code,
you specify the full classpath, namely "javac -classpath .:/usr/share/java/junit.jar
YourProgram.java"
|
-
Run-time errors: when using the testRunners you must
supply the following classpath: "java -classpath .:/usr/share/java/junit.jar
junit.USERINTERFACE.TextRunner YourProgram"
|
-
Another way to access the GUI testRunner is by simply typing
"junit" on the command line. This will automatically open the GUI application.
|
User Guide
Our complete Junit Tutorial can be found
here. It introduces you to a simple Junit
testing program and demonstrates the different Junit "testRunners" one can use.
Software Availability
Here is a copy of the program used in the java tutorial:
SimpleTest.java
Here is a copy of the program used for testing our Mastermind
game: TestMM.zip
References
README:
a readme file for JUnit version 3.8
Documentation for JUnit: shows all classes and methods available for JUnit.
FAQ:
some frequently asked questions about using JUnit.
Back to
Top
|