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.
  1. Open a flow, right-click a block in the flow, and click 
    Edit Items
    , and go to the 
    Automation
     tab.
  2. Use the 
    Add
     and 
    Edit
     buttons to add the required automation. In the case of a decision block, add automation for each output.
    • Automation Layer
      Defines into which layer this steps belongs.
       
    • Automation Step Type
      Specifies 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.
        Under 
        Details
        , define the following properties:
        • Object Name
           
        • Object Type
           
        • Action
           
        • Repeater
          Lets 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 text
        Lets 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.
        Under 
        Details
        , define the following properties:
        • Use the text field to enter free-form text.
        • Repeater
          Lets 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.
  3. (Optional) Click the 
    Sections
     tab to define the sections in which you want to include this step.
    • Name
      Displays the names of available sections that you have defined in the Automation Configuration.
    • Description
      Displays the description that you have defined in the Automation Configuration for this section.
    • Selected
      Lets you define in which sections you want to include this step. You control the default selection in the Automation Configuration.
  4. 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. Do 
      one
       of the following:
      • Type a constant value.
      • Use a test data variable.
      • Edit a resolvable value in Data Painter.
      • Embed another 
        Automation Step
        .
  5. (Optional) Click 
    Preview Snippets
     (green checkmark icon) to review resolved code snippets for each layer.
  6. Click 
    Save
    .
Store and Review Paths
For more information about how to store paths, see Store Paths.
  1. Go to the 
    Manage
     tab and open the 
    Path Explorer
    .
  2. Go to the 
    Generate Test Cases
     tab and click 
    Start Optimization
  3. Click 
    Store Path
    .
  4. Go to the 
    View Test Cases
     tab which contains the stored paths. 
  5. Click the 
    Automation
     tab.
  6. 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.
  1. Go to the 
    Manage
     tab and open the 
    Path Explorer
    .
  2. Go to the 
    View Test Cases
     tab and click 
    Export Paths
    .
  3. Choose 
    Automation 
    from the drop-down, and click 
    Export
    .
    The Export Automation Scripts window opens.
  4. Review the scripts in each layer and define a 
    File Name
     for each script.
  5. (Optional) Define advanced properties.
    • Choose whether to generate a 
      Wrapper
       for an external test automation tool, such as Blazemeter Taurus.
    • Define additional 
      Header
       and 
      Footer
       parameters for paths and blocks, respectively.
  6. Decide whether you want to generate 
    separate
     scripts, or one 
    merged
     script.
  7. Define the 
    Script Directory
     where to save the files.
  8. Click 
    Export
    .
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.
  1. File Name
     — Defines the name of the wrapper file.
  2. Executor
     — Specifies the underlying test tool.
    • Selenium
    • Mocha
    • RSpec
    • Nose
  3. 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.
  4. Script Concurrent Execution
     — Specifies how many scripts run at the same time, for example, the number of simulated users in a load test.
  5. Script Iteration
     —Specifies how often each test case is repeated.
  6. Configuration Options
     — Defines custom configurations. Click 
    Add Configuration
     to add more configurations.
    Example:
    modules: cloud: test: AgileDesigner Taurus Export services: - module: shellexec prepare: npm install selenium-webdriver
  7. Click 
    OK
    .
 
Agile Requirements Designer
 now additionally exports a wrapper file, for example a .yml file.