Test methods
When we developed Java utility and page object classes, we added exception handling to the methods. In some cases, methods can include specific exception types or just throw general exception conditions. Users often use the try...catch...finally syntax to trap exceptions and handle them using a custom set of actions, but using this syntax should not be exclusive. We want exceptions to occur implicitly or explicitly so we get the exception type and stack trace for debugging.
Page object methods called from within test methods can also throw exceptions when certain conditions are not met. So, at any point in the test, an exception could "break" out of the test method and turn over control to the @AfterMethod, routine per TestNG. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access