As an example of password strength meter I use the code from GitHub. Firstly, it calculates the score by adding or deducting points according to the length, whether a password contains numbers, chars, username or repetition. And then in accordance with the score a password strength is returned. Below you can find the function returning the strength.
function scoreText(score) {
if (score === -1) {
return options.shortPass;
}
if (score === -2) {
return options.containsField;
}
score = score < 0 ? 0 : score;
if (score < 34) {
return options.badPass;
}
if (score < 68) {
return options.goodPass;
}
return options.strongPass;
}
I define the equivalence classes as follows:
- {score = -1, short password}
- {score = -2, contains field (username)}
- {score < 34, bad password}
- {score < 68, good password}
- {score >= 68, strong password}
Can these classes be considered appropriate and adequate for testing? Or is it better to define the classes as categories such as "the password length is less than the min length", "a password has 3 symbols", "a password has upper and lower case" and etc?