Last updated: Oct 29, 2019 12:34
The failure reason administration is available for Administrator users.
Failure Reasons tab
Failure Reason Names
Perfecto pre-defines several failure reasons, including:
- Element not found
- Invalid XPath syntax
- Multiple elements found
- Popup handling
Each of the names has a color associated with it. The color is used by the Smart Reporting UI to more easily indicate the different test report failure reasons.
The user can define additional failure reasons. Pre-defined failure reasons can be renamed or updated with a different color.
Blocked Failure Reasons
App not found
Install app failure
Launch app failure
Device allocation related:
Device in use
Device not connected
Device not found
Device not available
Capability not supported
Custom Failure Reasons
Adding a new Custom Failure Reason
To add a new custom failure reason name string:
- Open the Admin tab of the reporting Smart Reporting interface.
- Select the FAILURE REASONS tab (displays all of the existing failure reason names)
- Click on the Add another failure reason link (at bottom of the list)
- Enter the failure reason name string (maximum 25 characters) in the text box
- Select a color for the failure reason
- Click the check-mark to add the name, or the X to cancel the addition.
Note: System supports a maximum of 8 additional (beyond those supplied by default) failure reason names.
Custom Failure Reason IDs
Each custom failure reason string is assigned a unique ID. This ID is used by the test scripts to indicate what caused a test to fail (see below).
To see the ID assigned to a particular failure reason -
- Open the list of defined failure reasons, by opening the FAILURE REASONS tab of the Admin area.
- Hover over the failure reason string - a tooltip displays the assigned ID.
To copy the ID either directly into a test script, or into a text file used by the test scripts to obtain the different failure reason IDs -
- Hover over the row of the custom failure reason - a copy to clipboard icon ( ) is displayed at right end of row.
- Hover over the icon to display a tooltip that displays the failure reason ID.
- Click the icon to copy the ID to the clipboard.
- Paste the ID into the destination text (or code) file.
Using Custom Failure Reasons in Test Scripts
Both the Smart Reporting SDK and the External Test Information SDK support supplying the failure reason, for a test script or report, using the TestResultFactory's createFailure() method.
The method supports three parameters:
- A failure message that will be added to the test report.
- The actual error notification - throwable entity.
- A failure reason ID String. The string must match one of the defined failure reason IDs (see above). If the provided string does not match any of the defined failure reasons, it will be ignored.
The following example shows how to create the failure TestResult with a failure reason (one of the basic failure reasons supplied by Perfecto):
See a full example test code here.