Don’t use hard assertions everywhere!
#Assertions #SoftAssertions #HardAssertions #Verifications
Assertions are the guide sticks in test automation. Hence the assertions play the most vital role in test automation to identify issues in the system under test. Adding more meaningful assertions will offer reliability in the functionality of the application.
More assertions → more checkpoints → more functional validations.
Mainly there are two types of assertions.
- Hard Assertions
- Soft Assertions
Hard Assertions would validate the expected and actual values right on spot, causing the tests to fail on the spot if there are discrepancies.
Soft Assertions would validate all the assertions and if there are discrepancies, would fail after validating all the assertions.
Each has its own usages, advantages, and disadvantages. Here is my article on Hard Assertions.