← Back to libraryQuestion 137 of 273
πŸ§ͺSeleniumBeginner

Assertions and Verifications

πŸ“– Detailed Explanation:

Assertions (Hard Assert) are 'Critical Failures'β€”the test stops immediately and marks as FAILED. Verifications (Soft Assert) are 'Non-Critical'β€”the test logs the failure but continues to the next step and marks as FAILED at the end. Hard asserts are used for blocking issues, while soft asserts are used for non-blocking issues. Choosing the right type is crucial for test design.

🌍 Real-World Example:

Hard Assert: If the login fails, there's no point checking if the dashboard loads. Soft Assert: If the username is misspelled, we still want to check if the profile picture loaded correctly.

🎯 Scenario-Based Interview Question:

You are testing a checkout page. You want to check the 'User Name' is correct and that the 'Total Price' is correct. Which one should be a Hard Assert?