As the amount of code is beginning to reach a critical
mass, every class should have an automated unit test.
This is needed for regression test purposes and to
ensure developers don't check in code that breaks
existing functionality.
As far as I can see there are two types of tests.
1. It should be easy to write junit tests for model and
data access classes. So I expect these to be written.
2. Automated testing of the front end is a bit more
involved. We should look into how this can be achieved
e.g. cactus or httpunit.
To separate the code, perhaps we should create a new
project and package structure e.g.
unittest.j2eeslashcode.UserTest etc.
Logged In: YES
user_id=104837
Please write a junit test for one class in the structure,
and alter build.xml to perform all tests when someone types
'ant test'.
I will look at how you've built the test and write tests for
all other classes.
Logged In: YES
user_id=522688
will write junit for class containing the code that creates an
MD5 hash of the user's password. Please produce a file using
the Perl slashcode that contains 1000 random passwords
and their hashes. Ensure that passwords of the minimum and
maximum length are included and that there is a fair selection
of good and bad passwords e.g. dy3726YnqWEd and
password.
Logged In: YES
user_id=104837
see files in test/md5
md5test.pl produces two files, one (plain.txt) containing
1000 plaintext words between 6 and 20 characters in length
excluding chars 10 and 138, each followed by a newline. The
other (hashed.txt) contains 1000 md5 hashes followed by
newlines.
over to you....
Logged In: YES
user_id=522688
See src/unittest/j2eeslashcode/UserTest.java
Sadly the test fails in a pretty spectacular way. We'll have
to talk about this. I'll raise two more bugs.
The test should automatically run when you do an ant deploy
from within eclipse or off the command line. Please can you
check this. I've also commited an eclipse-HOWTO as well.
Logged In: YES
user_id=522688
JUnit test for the User class is now complete. Simply follow
the style given in the code and write the rest of the tests
;-) Writing the test has been worthwhile as, in addition to
the reasons given when this bug was raised, I've learnt more
about BufferedReader.readline() and when User.equals() is used.
The test should automatically run when you do an ant deploy
or ant unittest from within eclipse or off the command line.
Please can you check this. I've also commited an
eclipse-HOWTO as well.