The Step Failure Details dialog collects all the information related to the failed test step. This includes failure details, screenshots, and a snapshot of the DOM. For some of the possible failures you can find resolution suggestions directly from the dialog.
Let's use a very simple test as a baseline, which navigates to bing.com and verifies the text content of the Images link. The one demonstrated below is modified to look for 'ImagesModifiedToFail' instead of 'Images' so that it actually fails.
Execute the sample test and wait until it fails. Hover the mouse over the red cross next to the failed step - a Step Failure Summary will popup for a while.
Click on the red cross to open the overall Step Failure Details with possible options to resolve the encountered error.
The failure dialog provides a variety of useful details, which can be used for the different failure scenarios, divided in few tabs. Let's have an overview for each of these tabs and how these can help us find the solution for the failing step.
The 'Failure' tab provides a summarized information for the encountered error - sometimes this can be quite descriptive, and other times it could be more generic.
From this view you can also access other useful options:
View Exception Details: lists the log for the failed test step only.
Complete Test Log: displays the entire test log in the format of the quick execution log.
Copy: copies the exception details for the failed step to the clipboard to paste into another application.
Export: saves a zipped file containing a text file with the failed step log, the complete test log, a screenshot of the web page when the failure occurred, and a snapshot of the DOM tree in XML form.
Submit Bug: loads the Submit Bug dialog and logs a bug, if you have configured a bug tracking application.
Resolve: navigates to the 'Resolve Failure' tab, where you will get suggestions to apply a fix depending on the error.
The 'Images' tab displays two screenshots of the browser: the state at time of failure and the expected state. Storyboard must be enabled in Project Settings for the expected state image to appear.
The 'Page DOM' tab displays a snapshot of the DOM state at the time of failure. You can use it to locate the element in the DOM tree and check its state, content, etc.
When to use the DOM on Failure?
The DOM on Failure is most helpful in situations where a test does not properly locate and act on a particular element. This includes any of the following, when unexpected:
- 'Element does not exist' exceptions;
- 'Element not found' exceptions;
- 'Timed out waiting for element' exceptions;
- Test execution targets incorrect element.
What to look for in the DOM on Failure?
The DOM on Failure provides a record of the elements that Test Studio could see in the browser at the time the test failed. Compare with the find logic of the element that Test Studio expects to be in the browser during the failed step. This helps to identify which element should have been targeted, why the incorrect element may have been targeted, or what state the browser may have been in instead of the correct state.
The 'Resolve Failure' tab provides the opportunity to identify and correct the issue that caused the failure. For validation steps, the Sentence Verification Builder allows you to reload the page, make changes to the verification sentence, and re-run the verification until the verification passes.
In case the failure is caused by an element, which cannot be located on the page, the 'Resolve Failure' tab provides different options to change the elements find expression.
If the element was located on the page using the backup search recorded for it, you can directly choose the 'Troubleshoot' button. You can choose between the automatic update of search criteria used, or manually select a new element.
When a test is failing and you need to share the identified faulty behavior with a team mate, developer, or the Test Studio Support team, you can easily export the complete set of failure details into a single zipped file. The archive contains the failed step log, the complete test execution log, a screenshot of the web page and a snapshot of the DOM tree at the time of failure. To get the zipped file, click on the Export button on the Failure tab and choose a folder where to store it.