Page History
...
In addition, Automate scripts makes it easier to write correct Gherkin scripts through its syntax highlighting and autocomplete features.
How to create
Access Hexawise Automate automate scripts by creating or opening a test model and navigating to the "Auto-Scripts" tabmenu. Once there, select the "Automated Testing" toggle option in the window headermenu.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 the Usage button.
Tip |
---|
You can create as many Gherkin/Robot Framework feature files as you need for your test model, one per tab. Click the button in the tab bar to add another feature file. Click the button on a tab to rename a feature file, and the button to delete a feature file. |
Each feature file can include as many Scenario and Scenario Outline sections as you need. Variations are then automatically provided for you from your generated test cases. When you use a Scenario Outline the variations are provided in an Examples data table. When you use a Scenario, it acts as a template and a unique Scenario is automatically generated for each test case.
Edit your Gherkin feature in the editor in the panel on the left, and the generated Examples data tables and generated Scenario sections are shown in the preview on the right. You must generate test cases first before the preview becomes active.
To include parameter values from your test cases in a Scenario or Scenario Outline, simply enter the parameter name surrounded by angle brackets into a step. Automate will help you by autcompleting parameter names once you type <.
Feature: Use Automate
Scenario: including parameters in Gherkin
Given I select <State> from the state dropdown
And I input <Age> into the age input
When I push the "Go" button
Then I should see the completion indicator
From the script above, Automate will automatically generate a Scenario for every test case that has a unique combination of the included parameters, "State" and "Age", and will substitute parameter values from each test case into the text of the step. A generated Scenario might look like this:
# OUTPUT
Feature: Use Automate
Scenario: including parameters in Gherkin
Given I select North Carolina from the state dropdown
And I input 18 into the age input
When I push the "Go" button
Then I should see the completion indicator
# etc, one Scenario block for each unique test case
If you use Scenario Outline in place of Scenario in the same example, Automate will instead automatically generate an Examples table with one column for each included parameter, and one row for for every test case that has a unique combination of the included parameters. Here is an example of that output:
# OUTPUT
Feature: Use Automate
Scenario Outline: including parameters in Gherkin
Given I select <State> from the state dropdown
And I input <Age> into the age input
When I push the "Go" button
Then I should see the completion indicator
Examples:
| State | Age |
| North Carolina | 18 |
| Indiana | 28 |
| New Jersey | 42 |
# etc, one row for each unique test case
If a specific behavior doesn't apply to every test case, you can restrict a Scenario or Scenario Outline to only include the test cases that match a particular set of parameter values. The selector syntax utilizes curly braces { } and square brackets [ ] as such: {Parameter[Value 1]} -or- {Parameter[Value 1, Value 2, ...]} Automate will help you with the syntax by autcompleting once you type {. Here's an example which only includes test cases that have "North Carolina" or "Indiana" as the value of the "State" parameter:
Feature: Automate selectors
Scenario Outline: including parameters in Gherkin
Given I select {State[North Carolina, Indiana]} from the state dropdown
And I input <Age> into the age input
When I push the "Go" button
Then I should see the completion indicator
Which results in only test cases with "North Carolina" and "Indiana" in the Examples table:
# OUTPUT
Feature: Automate selectors
Scenario Outline: including parameters in Gherkin
Given I select <State> from the state dropdown
And I input <Age> into the age input
When I push the "Go" button
Then I should see the completion indicator
Examples:
| State | Age |
| North Carolina | 23 |
| Indiana | 18 |
| North Carolina | 48 |
| Indiana | 48 |
# etc, one row for each unique test case with "State" as "North Carolina" or "Indiana"
It is also possible to invert a restriction by adding an exclamation point just after the opening curly bracket, like so: {!Parameter[Value 1, Value 2]} This includes all the test cases in which "Parameter" is not "Value 1" or "Value 2".
If you find yourself needing to restrict the test cases of every behavior in a feature file, you can conveniently use the same selector syntax in the Background section of a feature file, like this:
Feature: global restrictions in the Background section
Background:
Given I select {State[New Jersey]} from the state dropdown
# Every Scenario/Outline block is now restricted to test cases
# in which the "State" parameter has the value "New Jersey"
In addition to the parameters defined in the test model, Automate provides a few "pseudo-parameters" that can be helpful in some situations:
Test NumberA purely sequential number for the row or generated Scenario.Test CaseThe index of the generated test case that corresponds to this Examples row or generated Scenario. This number may have gaps and so not be purely sequential.Expected OutcomeA comma-separated list of any Expected Outcomes that apply to the test case as defined with Requirements.
Here's an example using all of the pseudo-parameters:
# OUTPUT
Feature: Use Automate pseudo-parameters
Scenario Outline:
Given this is test <Test Number> for test case <Test Case>
When I select <State> from the state dropdown
And I input <Age> into the age input
And I push the "Go" button
Then the claim is <Expected Outcome>
Examples:
| Test Number | Test Case | State | Age | Expected Outcome |
| 1 | 3 | North Carolina | 18 | denied |
| 2 | 5 | Indiana | 28 | |
| 3 | 7 | New Jersey | 42 | accpeted |
# etc, one row for each unique test case
Bring back these tips again by click the Usage button on the right side of screen, above the Preview section.
...