Hexawise Automate is a tool that makes it easy to write behavioral driven development (BDD) automated acceptance tests in Gherkin format as data-driven scripts. These data-driven test scripts are based on a Hexawise test plan, so they are more maintainable than traditional BDD/Gherkin test scripts.

Automated test scripts are notoriously expensive to maintain, and BDD/Gherkin test scripts are not immune to this problem. Normally changes to the system under test, or just changes to how the system will be tested means having to make changes to tens, hundreds, or (in some cases) thousands of feature files. With data-driven Hexawise Automate test scripts though, that's not the case. Adding or removing parameter values, requirements, or constraints to the Hexawise test plan updates the data driving the Hexawise Automate test scripts, but there is no need to update the test scripts themselves.

In addition, Hexawise Automate makes it easier to write correct Gherkin scripts through it’s syntax highlighting and autocomplete features.

Automate Usage Tips

Access Hexawise Automate by creating or opening a test plan and navigating to the "Auto-Scripts" tab. Once there, select the "Automated Testing" toggle in the window header.

Dismiss the section at the top of the page containing useful hints for inserting Hexawise parameters into a Scenario or Scenario Outline, restricting a Scenario or Scenario Outline to test cases that contain certain values, etc. by clicking Dismiss these tips

Bring back these tips again by click the Automate Usage link on the right side of the purple menu bar next to Share.

Gherkin Feature File

The Hexawise Automate screen is a smart Gherkin feature file editor. It is aware of both the parameters, parameter values, and generated test cases of the current Hexawise test plan and the Gherkin test script syntax. It makes it easy to create a feature file containing data-driven Scenario  and Scenario Outline sections that are populated by the generated test cases of the Hexawise test plan.

Feature

Each Gherkin script has a Feature as its first keyword followed by : and a little bit of text to describe the feature, usually in the form of a user story which is demonstrated in the placeholder text.

Background

A Background section is useful when a set of initial setup steps is repeated for every Scenario  and Scenario Outline in the feature file. The steps of the Background are run before each Scenario Outline and Scenario.

Scenario

Next in the feature file is the enumeration of different testing scenarios. One way to describe a test scenario is with a Scenario section. A Scenario section contains the sequential steps, expressed as plain English Given/When/Then statements, that describe the necessary actions for executing the automated test script. If the Hexawise test plan generates 42 test cases, then 42 Scenario sections would need to be written out in order to achieve the combinatorial coverage.

However, instead of writing out all 42 test cases individually, with Hexawise Automate a single data-driven Scenario that includes the <Parameter Name> syntax can generate all 42 needed Scenario sections in the exported feature file.

Hexawise Automate provides a way to include the value of any test case parameter in a Scenario using the <Parameter Name> syntax. Simply typing < will populate a list of autocomplete suggestions related to all of the parameters in the plan. Wherever the <Parameter Name> appears in the test steps it will be replaced by the specified parameter's value for the test case being tested. This is conceptually very similar to how manual testing auto-scripts work in Hexawise.

For example, writing the test step:

And they select <Color> for the car's color 

Means that for each generated Scenario  section (one for each test case), the <Color>  portion of the test step will be replaced with the value of the Color parameter in the generated test case:

And they select Deep Blue Metallic for the car's color 

Writing a data-driven Scenario with at least one <Parameter> reference for the 2-way test set for this plan would lead to a .feature file export containing 42 Scenario sections in the feature file, one for each of the 42 Hexawise generated test cases.

A Hexawise Automate feature file can contain as many Scenario section and data-driven Scenario sections as needed to automate all the testing ideas contained in the Hexawise test plan.

Scenario Outline

A Scenario Outline behaves almost exactly like a data-driven Scenario and can be used anywhere instead of a data-driven Scenario  section. When using a Scenario Outline  instead of having 42 Scenario sections in the export (one for each test case), the export has one data-driven Scenario Outline with a Gherkin Examples data table attached to it that contains 42 rows (one for each test case). Hexawise Automate shows an expandable preview of the Examples data table.

A Hexawise Automate feature file can contain as many Scenario Outline sections as needed to automate all the testing ideas contained in the Hexawise test plan and can include both Scenario and Scenario Outline sections in the same feature file.

Where possible, using data-driven Scenario Outline sections is preferable to generating many data-driven Scenario sections as it's a more compact and direct expression of the testing ideas of the Hexawise test plan.

Restricting a Scenario or Scenario Outline to Test Cases with Specific Values

Often times applications may have more or fewer test steps that need to be executed for specific test cases.

For example, in Tesla's car configurator, if the user is configuring a new Tesla Model S, there is no option for the Interior Layout. The Hexawise test plan for the Tesla car configurator contains a bi-directional married pair constraint tying Model = Model S and Interior Layout = N/A together in the plan shown in the example screenshots throughout this guide.

Rather than have Scenario or Scenario Outline sections that for some test cases will read:

And they select the N/A Interior Layout 

Hexawise Automate provides a way to restrict a Scenario or Scenario Outline to test cases that contain a specific value using the {[Parameter Name]Parameter Value} syntax. Simply typing { will populate a list of autocomplete suggestions related to all of the parameter values in the plan.

Including {[Parameter Name]Parameter Value} anywhere in the set of steps in a Scenario or Scenario Outline  will restrict the test cases included in the Examples data table or in the generated Scenario sections to those that contain the specified parameter value of the specified parameter. 

For example, specifying {[Model]Model S} in the following Scenario Outline restricts the generated Example data table to only those test cases that include Model = Model S.

Since this scenario is only associated with test cases including a Model S, the steps specific to a Model X (i.e. the steps mentioning parameters whose value will always be N/A given Model = Model S) can safely be left out.

Stopping here is not sufficient. The exported .feature file will not include any test cases mentioning a Model X. Creating another Scenario Outline using the syntax {[Model]Model X}, and including the additional test steps specific to the Model X will finish this testing idea.

Restricting a Feature File (all Scenarios and Scenario Outlines) to Test Cases with Specific Values

Hexawise Automate can restrict every Scenario and Scenario Outline in the feature file by using the {[Parameter]Parameter Value} syntax in the Background section.

Including Expected Outcomes from the Hexawise Requirements

Often times a test case that's been forced as a combination of three or more values on the requirements screen will have an associated expected outcome that needs to be verified. Include the value of the Expected Outcome in the test script as if it were a parameter by including <Expected Outcome> in one of the steps.

Add Additional Testing Ideas Not Expressed in the Hexawise Test Plan

There are situations where certain testing ideas did not make it into your Hexawise test plan. Often these ideas represent expected outcomes or validation steps. These ideas may be necessary to complete the test script. 

By using the <Parameter Name>  syntax, but intentionally not using the name of a parameter in the Hexawise test plan, you can include <Some Additional Idea> and Automate will add an additional column to the Gherkin Examples data table. This column will be empty in the exported feature file, allowing you to fill in the necessary blanks.

In the example below, the Hexawise test plan does not have a parameter called Browser. but <Browser> has been included in one of the steps for a Scenario Outline.

If there is a parameter in your plan that contained only a single value (because that value must be true for all of the test cases generated), you can remove that parameter from the model entirely and still have an equally-detailed Automate script. For example, all instances of Tesla Model S and Model X must have the Premium Upgrade Package = Equipped.

To include this idea there are three choices:

  1. Simply type out the needed step without any reference to a <Parameter Name> or {[Parameter Name]Parameter Value}. This is most appropriate if it's assumed that this testing idea is unlikely to expand to other variations in the future. 
  2. Leave out the Premium Upgrade Package from the model and insert {[Premium Upgrade Package]Equipped} in your Automate script. This is most appropriate if it's unsure if this testing idea will eventually expand to other variations in the future.  
  3. Include a parameter in your model called Premium Upgrade Package with a single value Equipped and insert <Premium Upgrade Package> in your Automate script. This is most appropriate if it's expected this testing idea to expand to other variations in the near future. 

Including One-off and Negative Testing Ideas

Take advantage of the free-form nature of a Gherkin Scenario to include testing ideas that don't come from the Hexawise generated test cases by adding Scenario sections that don't include any <Parameter Name> or {[Parameter Name]Parameter Value} syntax.

Using a Scenario also makes it easy to include negative test cases without making adjustments to your model.

Did this answer your question?