QuestionQ21

Agile software development and Test Techniques

You need to implement a Java class that validates a password-entry field. The validation criteria state that the password must:

  1. Be at least 8 characters long.
  2. Include at least one special character.

You are concentrating on validation criterion 1 and have written a test class verifying that a 7-character password entry fails validation.

You have written code intended to make this test class pass; however, it failed on the test class’s first execution.

What should you do next?

Explanation

A failing test after implementing the behavior indicates that the implementation does not yet meet the specified condition. Repair the code until the 7-character input correctly fails validation, then re-execute the test. Refactoring is appropriate only after the test passes.

Community Discussion

No comments yet. Be the first to start the discussion!