I created a scenario in ScenarioBuilder, but it failed when I played it. How can I go about investigating why it failed in order to fix it?
There are different tools that can help you investigate and fix failures in your scenario.
4) Debug Image
The ScenarioBuilder Execution Report is displayed after the scenario finishes playing. You can also find the Execution Report for your latest run by clicking on “Run” in the main menu of ScenarioBuilder, then “View Report” button.
The Execution Report will tell you the status of the scenario (success, fail). If it failed, it will tell you in which scenario or sub-scenario it failed, at which step it failed, and why it failed.
Once you know where it failed at, then you can investigate why it failed by looking at what occurred up to that point. The Execution Timeline will help you with this.
From the ScenarioBuilder Execution Report, click on “View Execution Timeline” to view the Execution Timeline. If you have already closed out of the Execution Report, you can view the Execution Timeline of your latest scenario run by clicking on “Run” in the main menu of ScenarioBuilder. Next click on the “View Report” button, then “View Execution Timeline”.
The Execution Timeline shows:
- The time that each step was executed.
- A screenshot of the screen just prior to the step (click on the step to view screenshot).
- How long it took to find an image
- Which variable was used
- How many times a loop was performed
- The coordinates of a mouse click action
- If an “if” statement was true or false
The Execution Timeline will allow you to see where the scenario failed and determine if the failure occurred at that point or was it due to something that did or did not occur in a previous step.
NOTE: The mouse coordinates that you see in the script in ScenarioBuilder may be different than the mouse coordinates you see in the Execution Timeline if you select “Use Anchor” in the “Mouse Move and Click” action properties.
For example, notice in this step, the parent command is “Find Image”, and the child command is “Mouse Move and Click”. Also, notice the “anchored” property.
If we check the properties of the image, we will find that the anchor position for X and for Y is “Center”. This means that the center of the image is (0,0). In the script in ScenarioBuilder, it shows the mouse coordinates based on the center of the image as the anchor.
However after you play a scenario in ScenarioBuilder and view the Execution Timeline, you may see different coordinates for the same step. This does not mean that the click occurred in the wrong spot. The reason is it displays the coordinates of the click based on the screen with top left corner of screen as (0,0).
Smart Image Configurator
The Smart Image Configurator is ScenarioBuilder's built-in tool view, search, and modify images that are included in test scenarios. View the below video to learn how to use the Smart Image Configurator to investigate and fix "find image" failures in your scenarios.
Related Article: How to use ScenarioBuilder Smart Image Configurator
The Debug Image tool is useful when you have "Find Image" actions with "move mouse and click" actions or "Click on Image" actions in your scenario. This tool will provide you with a screenshot of the screen when the click occurred and it will mark the spot that the mouse click occurred on.
After you play your scenario, this red dot icon will appear to the far right of the "Find Image" or "Click on Image" step.
Click on the icon to open the screenshot. On the screenshot, the spot that the mouse click occurs on will be marked with a red + and the step #.
Determining if the mouse click occurred in the correct spot or not will provide insight into where the failure in your scenario actually occurred and set you on the right path to fix the failure.