in reply to Unit Testing Non-Deterministic Behaviors
This depends on how you pick the word from the file and create the number, but if you use rand for both Test::MockRandom may be a good solution for you. Essentially, this allows you to override rand in the tested module, and make it return known results which you can test for.
Just as a note, IMO a random word from a file with a number stuck at the end is a pretty horrible password generator and will almost certainly produce some easily guessable passwords over time. This is in addition to the oft-repeated mistake of sending a cleartext password through unencrypted mail. It would be better to generate a random string to send to the user for logging on once to enter a password of his own (advising some best practices on password generation on the same page).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unit Testing Non-Deterministic Behaviors
by ww (Archbishop) on Jun 11, 2007 at 10:41 UTC | |
|
Re^2: Unit Testing Non-Deterministic Behaviors
by friedo (Prior) on Jun 11, 2007 at 14:58 UTC | |
by tirwhan (Abbot) on Jun 11, 2007 at 16:19 UTC |