Construct Scripts from a Model
After you define your automation configuration and flow properties, you associate actions with code snippets. Each block in the flow has a properties window where you define the action's automation parameters. After exporting all paths as automation scripts, you can run them in your automation tool.
ard28
After you define your automation configuration and flow properties, you associate actions with code snippets. Each block in the flow has a properties window where you define the action's automation parameters. After exporting all paths as automation scripts, you can run them in your automation tool.
2
Automation Variable Considerations
You can define Automation Variables for each Automation Step in four different ways:
- Type a constant value.
- Use a test data variable.
- Edit a resolvable value in Data Painter.
- Embed another step (Nested Automation Steps)
Data Painter
Test data variables can have only one value within a path, even if you use a Data Painter function. If you need a unique value for each occurrence of the variable in the path, use a Data Painter function directly in the block.
Nested Automation Steps
You embed automation steps if you want to use actions both on their own and as evaluated expressions. A typical case is when you need to chain actions together to build functions. For example, you can use them to implement common standard procedures and control flow statements (for-loops, if statements, do-while, for-each, begin, try, catch, finally, switch); or to perform operator overloading in a language-neutral way. Note that the ability to embed Automation Steps also makes Automation Steps recursive. When the Automation Script for a path is generated, the nested step is resolved in the same way as the other three options: The Automation Variable in the parent code snippet is replaced by the entire code snippet of the child. The intention is to emulate functions being passed as parameters to other functions.
Consider the following limitations when you embed automation steps:
- You define the Automation Configuration using the Step Join. Do not define code snippets as statements with a new line in the end of every action. The Step Join is not applied to nested Actions, only on top-level actions.
- Nested steps are of the same Layer as their parent.
- Nested steps cannot have a repeater.
Construct Scripts
Repeaters are helpful when you want to output, for example, a series of list items or attributes with different values. Use Data Painter to define the functions, variables, or columns used in the code snippet.
- Open a flow, right-click a block in the flow, and clickEdit Items, and go to theAutomationtab.
- Use theAddandEditbuttons to add the required automation. In the case of a decision block, add automation for each output.
- Automation LayerDefines into which layer this steps belongs.
- Automation Step TypeSpecifies one of the following types:
- Code snippet as an Object-Action pair from configuration(Recommended) Lets you reuse the common code snippets that you predefined in the automation configuration. The script is stored dynamically in the automation configuration, which makes maintenance and updating easier.UnderDetails, define the following properties:
- Object Name
- Object Type
- Action
- RepeaterLets you specify a number how many variations of the snippet you want to insert. By default, the snippet is inserted once. Set the Repeater value to 0 to indicate situations where you do not want to add the respective automation snippet.
- Code snippet as free-form textLets you insert a one-off code snippet that you have not predefined in the automation configuration. You can insert all types of values that you can insert into a preconfigured code snippet, including automation variables, but excluding Object Name References. The script is stored statically in the flow, which can make future maintenance and updating more complicated if you overuse this type.UnderDetails, define the following properties:
- Use the text field to enter free-form text.
- RepeaterLets you specify a number how many variations of the snippet you want to insert. By default, the snippet is inserted once. Set the Repeater value to 0 to indicate situations where you do not want to add the respective automation snippet.
- (Optional) Click theSectionstab to define the sections in which you want to include this step.
- NameDisplays the names of available sections that you have defined in the Automation Configuration.
- DescriptionDisplays the description that you have defined in the Automation Configuration for this section.
- SelectedLets you define in which sections you want to include this step. You control the default selection in the Automation Configuration.
- Select a step.
- Exempt Items from Automation Headers and Footers(Optional) Specifies if to exclude specific blocks or decisions from being wrapped with automation headers and footers.
- Add Variables to Test Data(Optional) Defines the value of the variable in the selected line. Dooneof the following:
- Type a constant value.
- Use a test data variable.
- Edit a resolvable value in Data Painter.
- Embed anotherAutomation Step.
- (Optional) ClickPreview Snippets(green checkmark icon) to review resolved code snippets for each layer.
- ClickSave.
Store and Review Paths
For more information about how to store paths, see Store Paths.
- Go to theManagetab and open thePath Explorer.
- Go to theGenerate Test Casestab and clickStart Optimization.
- ClickStore Path.
- Go to theView Test Casestab which contains the stored paths.
- Click theAutomationtab.
- Review the fully substituted code snippets for each block, for each selected path, and for each layer.
Now you are ready to export paths in various formats, for example, as test scripts or as spreadsheet.
Export Scripts
You export paths as automation scripts to be able to run the exported files in your automation tool. You can export directly to integrated lifecycle tools; for more information, see Integration With Lifecycle Tools.
By default, the Export Automation Scripts window prefills fields with the values that you specified on the Export tab of the Automation Configuration for this layer.
- Go to theManagetab and open thePath Explorer.
- Go to theView Test Casestab and clickExport Paths.
- ChooseAutomationfrom the drop-down, and clickExport.The Export Automation Scripts window opens.
- Review the scripts in each layer and define aFile Namefor each script.
- (Optional) Define advanced properties.
- Choose whether to generate aWrapperfor an external test automation tool, such as Blazemeter Taurus.
- Define additionalHeaderandFooterparameters for paths and blocks, respectively.
- Decide whether you want to generateseparatescripts, or onemergedscript.
- Define theScript Directorywhere to save the files.
- ClickExport.
The automation scripts are exported.
Generate Wrapper
(Optional) If you have chosen to generate a wrapper for external test automation tools,
Agile Requirements Designer
prompts you to configure the accelerator after you click Export.- File Name— Defines the name of the wrapper file.
- Executor— Specifies the underlying test tool.
- Selenium
- Mocha
- RSpec
- Nose
- Cloud Location— (Optional) Defines a server location if you want to execute your tests on a specific server when running in the cloud, instead of allowing the cloud to choose.
- Script Concurrent Execution— Specifies how many scripts run at the same time, for example, the number of simulated users in a load test.
- Script Iteration—Specifies how often each test case is repeated.
- Configuration Options— Defines custom configurations. ClickAdd Configurationto add more configurations.Example:modules: cloud: test: AgileDesigner Taurus Export services: - module: shellexec prepare: npm install selenium-webdriver
- ClickOK.
Agile Requirements Designer
now additionally exports a wrapper file, for example a .yml file.