Posts

Showing posts from August, 2020

Benefits of Customised Assertions

Customised Assertions in your test automation framework : For complex and repetitive test scenarios, it can be useful to create custom assertions where  logic is plugged away from the tests and placed into separate class Customised assertions help us dive into the intent of the tests Plug in various features like attaching the responses , logging and so on which other wise gets complex using assertions straight away in tests  Example Custom assertion class : public abstract class Verify extends BaseClass {     public static void verifyTrue(boolean condition, String message, Object... response) {         try {             Assert.assertTrue(condition, message);         } catch (AssertionError e) {             // Perform actions like attaching or logging             Assert.fail(message);         }     } ...