Originally posted by GD Deepz:
How are you guys using JUnit to test lock/unlock. Anybody have any ideas. Writing a bunch of unit test for the locking mechanism is not going to tell me much. What am I looking for? and should the test consist of.
Thanks everyone
I run two kinds of tests against the locking code.
1) start multiple threads that cycle through the records and lock, delay and unlock. Keep track of the number of threads waiting for locks to be sure that there is some contention.
2) use a special client that allows you to do arbitrary operations against the data server. With this do specific tests of troublesome areas such as locking the same records from multiple clients, locking multiple records from multiple clients, locking the same record twice from the same client, unplugging the network connection,...
While doing this I use Emma to collect coverage statistics, you want the coverage on the locking to be 100%.