Last updated: Feb 02, 2020 14:44
- Log in to Perfecto at https://<cloud-name>.app.perfectomobile.com.
On the UI landing page, click Assets and Setup. By default, the view opens on the 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 name is associated with a color. In the Smart Reporting UI, the color helps identify the different failure reasons for the test reports.
You can rename system-supplied failure reasons, change their color, or define additional failure reasons.
Blocked failure reasons
Following is a list of blocked failure reasons.
App not found
Install app failure
Launch app failure
Device allocation-related reasons:
Device in use
Device not connected
Device not found
Device not available
Capability not supported
You cannot view or configure blocked failure reasons in this view.
Custom failure reasons
You can add up to 8 custom failure reasons.
To add a custom failure reason:
- At the bottom of the failure reasons list, click Add another failure reason. You may need to scroll down to see this option.
- In the text box, enter the name string for the new failure reason. The string cannot exceed 25 characters.
- Select a color for the failure reason.
- To add the name, click the checkmark. To cancel, click the X.
Custom failure reason IDs
Perfecto assigns each custom failure reason string a unique ID, as displayed in the ID column. You can copy-paste this ID into your tests scripts or into a text file used by the test scripts to indicate what caused a test to fail.
To copy a failure reason ID:
- Move your pointer over the ID to display the copy icon .
- Click the icon to copy the ID to the clipboard.
- Paste the ID into the destination text (or code) file.
Use custom failure reasons in test scripts
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
The method supports the following parameters:
- A failure message that is 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 the full example test code here.