Using Gherkin in Eggplant Functional for Behavior-Driven Development

You can use Eggplant Functional as part of a behavior-driven development (BDD) strategy. Eggplant Functional integrates with the Gherkin language, which uses a natural language syntax for test definition. Gherkin is part of the Cucumber framework for BDD, which aims to create a testing framework in easily readable language based on a few keywords.

Gherkin Integration with Eggplant Functional

You use Gherkin in the Suite window, similar to how you would write scripts in SenseTalk. In fact, Gherkin steps are tied to handlers written in SenseTalk, which are what perform the actions against your systems under test (SUTs).

The Eggplant Functional Suite window includes the Features pane in the left sidebar for working with Gherkin.

The Features pane highligthed in the Eggplant Functional Suite window
The Features pane highlighted in the Suite window

On the Assets Toggle Bar at the top of the sidebar, note the Gherkin (pickle) icon. You can use this button to toggle the Features pane view on or off.

Gherkin code is stored in .feature files, and you describe your tests as features and their expected behaviors, broken into scenarios. Then, you generate the SenseTalk handlers that perform the actions that the Gherkin steps describe.

Although you write your Gherkin code in the Features editor tab, the related SenseTalk handlers are stored in standard Eggplant Functional scripts. When you run a Gherkin test, Eggplant Functional calls the handlers from the associated script to perform the required actions. To learn more, see Running Gherkin Tests in Eggplant Functional.

Searching your existing Gherkin Tests

To search for a particular Gherkin feature in your suite, type part of a name or feature text 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.

Next Steps

To learn more about Gherkin code and writing tests with Gherkin, see Creating Tests with Gherkin. To see what happens when you run Gherkin tests, see Running Gherkin Tests in Eggplant Functional.

 

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

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant