January 2018
Beginner to intermediate
354 pages
7h 59m
English
In order to take a screenshot for a report, instead of trapping the exception (because it could occur in a number of places), users can let the test method break out, and query the result using the ITestResult interface. This allows the test to capture the correct screenshot at the point of the exception for debugging purposes.
Here is the same example as the last one using this strategy:
// this method aborts and let's the teardown cleanup @Test public void tc002_createUser(String RowID, String description, JSONObject testData) throws Exception { UserPO user = new UserPO(); // attempt to create a new user user.createUser(testData); // verify user was created user.verifyUser(testData.get("username").toString()); }
Read now
Unlock full access