ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 124 - CTAL-TTA discussion

Report
Export

You need to implement a Java class that validates a password entry field. The validation critena states that the password must:

1. be a minimum of 8 characters

2 contain at least one special character.

You are focusing on validation criterion 1 and have written a test class that checks that a 7 character password entry will fail validation.

You have written code designed to make this test class pass, however, on first execution of the test class it has failed

What should you do next9

SELECT ONE OPTION

A.
Repair the failing code and re-execute it for the test class
Answers
A.
Repair the failing code and re-execute it for the test class
B.
Develop a test class with a 9 character password containing one special character and re-execute the code
Answers
B.
Develop a test class with a 9 character password containing one special character and re-execute the code
C.
Add code to cover special character validation criterion 2
Answers
C.
Add code to cover special character validation criterion 2
D.
Refactor the failing code to improve its design and structure
Answers
D.
Refactor the failing code to improve its design and structure
Suggested answer: A

Explanation:

When a test class that validates a specific criterion (such as the minimum length of a password) fails, the immediate next step is to repair the failing code and re-execute the test. This approach adheres to the test-driven development (TDD) practices, where the cycle of writing a failing test, making it pass, and then refactoring is repeated. It ensures that each validation criterion is correctly implemented before moving on to additional functionalities or validations .

asked 18/09/2024
Trang Anna
38 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first