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.


  • 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.

Running Gherkin Tests from the Command Line

To run Gherkin tests from the command line, you use the runscript command. This process is essentially the same as it is for running scripts, including the available Runscript Command Line Options.

Important: Tags passed to Gherkin Features as parameters via a command line call will take precedence over tags passed as parameters in a SenseTalk script.



/Applications/ /Users/<username>/Documents/ePFSuites/gherkin.suite/Features/test1.feature -CommandLineOutput Yes


"C:\Program Files (x86)\Eggplant\runscript.bat" "C:\Users\<username>\Documents\FeatureImageEdit.suite\Features\test1.feature"

Note that in both examples above, following the full path to the runscript command, you would enter the full path and name for the .feature file you want to run.

For complete information about using the runscript command, see Running from the Command Line.

Viewing Results for Gherkin Tests

The results of Gherkin test runs can be found in the Results pane of the Suite window. Because you will have scripts with the same names as your Features, the Feature results are designated by adding -Feature to the end of the name in the Results pane. Results for Features provide the same information as is provided in script results.

To view the results for a Gherkin Feature test, select it in the Results pane. The top of the Results area shows the Run Date list, a listing by date and time for each run of the Feature. When you select a specific run date from the list, detailed information about that run appears below in the Log Area.

The Feature results shown in the Log Area include output from the Features themselves, and Log messages (such as Log, LogSuccess, LogWarning, and LogError, as well as Throw).

For complete information about using the Results pane and the information you can find here, see Results Pane.

Step-Level Reporting

Each step (a SenseTalk handler) is reported as an Eggplant Functional test case. As each step is completed, results for that step are logged as a test case. Only the EndTestCase command is printed in the results, which contains all of the relevant information about that step, including the Duration, Errors, Exceptions, Start Time, Successes, TestCase (the name of the Eggplant Functional handler containing the Gherkin step), and Warnings. The next case begins immediately following the EndTestCase output.

Searching Your Existing Features

To search for a particular feature in your suite, type part of a feature name in the search field above the Scripts list. (Note: This search function searches all the panes in the left sidebar simultaneously.) To set a search filter, click the magnifying glass beside the Search field and choose Search All, Search Names, or Search Contents from the drop-down list.

Tip: The search works as you type, so you might find your results before you finish entering your search term. However, if you have searches that you frequently repeat, you can save your search as an item in the Search History by pressing Return after you type the term. Your search is saved on the drop-down list under the magnifying glass.For complete information about using the search and replace function in the Suite window, see Using the Search Filter.


This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant