Running Gherkin Tests in Eggplant Functional
After you create Gherkin tests, which are described as Features, you can run them in the Eggplant Functional
For information about developing Gherkin tests, see Creating Tests with Gherkin.
Running Gherkin Tests in the Suite Window
- 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.
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 could wrap your Features in a SenseTalk master script to dynamically control execution of multiple Features. For information about using master scripts, see Running from a Master Script.
To call a Feature from a SenseTalk script, you use the RunFeature command with the name of the .feature file as the only required parameter:
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.
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.
/Applications/Eggplant.app/Contents/MacOS/runscript /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.
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 you would see for scripts. To view the results for a Gherkin 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 in the list, detailed information about that run appears below in the Log Area.
For complete information about using the Results pane and the information you can find here, see Results Pane.
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.