Running Gherkin Tests in Eggplant Functional
After you create Gherkin tests, which are described as Features, you can run them in the Eggplant Functional Suite window. It's also possible to trigger a Gherkin Feature from a SenseTalk script or from the command line. Each of these methods for running your Gherkin tests is described below. Results for Gherkin tests can be found in the Results pane of the Suite window.
For information about developing Gherkin tests, see Creating Tests with Gherkin.
Running Gherkin Tests in the Suite Window
Running a Gherkin test in the Eggplant Functional Suite window is similar to running scripts. With the test you want to run selected in the editor, you can:
-
Click the Run Script button.
or
-
Select lines in the Feature, then click Run Selection to run only the selected lines.
As you would expect, the test proceeds through the Scenarios in the order listed, and each step within each Scenario in order. When a step completes, it changes color to show the status:
- Green: The step completed successfully (however, see the note below about Passed Steps).
- Red: The step returned an error. This status might mean that the handler ran but logged an error, or it could mean that the associated handler was prevented from running (for instance, if you don't have a remote connection). Check the Results pane for the Feature to determine the specific cause of failure.
- Orange: This status indicates that no SenseTalk handler for the step was found. Either you have not generated the handler, or the text of the Gherkin step and the name of the handler no longer match. See Generating Handlers from Gherkin Steps for information about how handlers are generated and named.
Passed Steps
When you run a Feature test, the step status succeeds and turns green if the Gherkin step is able to connect to a SenseTalk handler and the handler runs without throwing an exception or logging an error. Note that this doesn't guarantee that the step tests what you intend it to. Be sure to test your SenseTalk handler code to ensure that it has the expected results on your systems under test (SUTs).
The Run Window
When you run a Gherkin test in the Features editor, it might be natural to view the steps as they change status. However, if you typically run SenseTalk scripts in the Eggplant Functional UI, you might be used to viewing the Run window.
For Gherkin tests, the Run window doesn't open by default. If you want to view the Run window as the test runs, you can open it by going to Window > Run Window on the main menu.
Running Gherkin Tests from SenseTalk Scripts
You can use regular SenseTalk scripts to call Gherkin Features. With this ability, you can wrap your Features in a SenseTalk primary script to dynamically control execution of multiple Features. For information, see Running from a Primary Script.
To call a Gherkin Feature from a SenseTalk script, use the RunFeature
command with the name of the .feature file as the only required parameter:
RunFeature "FeatureTest1"
If you use tags in your Feature definitions, you can include tag names as an optional parameter so that you can filter based on elements (e.g., Scenarios) with that tag:
RunFeature "FeatureTest1", "@important", "@regression"
You can include as many tags as you like. For information about how to use tags, see Advanced Gherkin Techniques.
Each Feature called by the RunFeature
command generates its own results file. See Viewing Results below for information about viewing Gherkin test results.