Autosnippet Generation in Eggplant Functional
The Autosnippet feature is part of an Autoscan session that lets you automatically generate SenseTalk scripts from detected elements in your system under test (SUT). The scripts that Eggplant Functional (EPF) generates contain short code snippets to perform common actions such as clicking buttons or entering text in a field.
Autosnippet scripts are divided into short sections for each detected element. Each section consists of one or more action handlers. The handlers in the generated script can be called to perform the action or validation on the element identified in the Autoscan session on your SUT.
Autosnippets are useful for modularizing scripts, and can be imported as snippets in Eggplant AI.
Step by Step: Generate Autosnippets
-
Perform an Autoscan session of a SUT, then open the session when the scan is complete.
-
Set the Element Type for any elements in the scan for which you want code snippets generated. If you are testing against a desktop SUT, this can be done using the Classify Images button displayed below the element code list during the session. For more information on how the Classify Images button works, see the step-by-step instructions for Using Autoscan to Capture Images.
The types of elements that can be selected from the Element Type drop-down list are:
- None: Use to generate an image but no code.
- Checkpoint: Generates two handlers that can be used to validate the presence of the element.
- Button: Generates a handler to click the element.
- Field: Generates two handlers, one for entering text in a field and one for reading text from a field.
- Checkbox: Generates a handler to select a checkbox.
- RadioButton: Generates a handler to select a radio button.
- DropDown_Mobile: Generates a handler, optimized for mobile device SUTs and mobile browsers, to select an item from a drop-down menu.
- DropDown_Desktop: Generates a handler, optimized for desktop SUTs and browsers, to select an item from a drop-down menu.
-
Set the Element Name. This field is required for Autosnippets. It is incorporated in the handler names generated in the script.
The Element Name gets set to match the Image Name when you set the Element Type. If you haven't set the Image Name, the value is a default in the form
image0005.You can update the Element Name field to ensure the name makes sense and matches any naming conventions you have established. For instance, you might not want the handler name and the image name to match.
-
Proceed through the list of elements you want to include. You can use the up and down arrows on the right side of the session tab to move through the detected elements. You can also click any of the rectangles in the scan in the center pane to select it. If you have processed all the elements that you want to keep and have additional elements that you don't want to keep, you can use the Delete unnamed images button to delete the unnecessary ones.
ノートWhen you select an element, either by using the arrows or directly in the center pane, the default name is autofilled. At that point, it won't be removed if you use the Delete unnamed images button. However, you can remove those elements if you don't need them by clicking the X in the rectangle's upper left corner.
-
Make sure the Script and Images checkboxes are both selected to generate scripts and images at the same time, then click Generate.
Eggplant Functional creates a new script with the name of the Autoscan session. The generated script opens in the Suite window.