2. Create a Feature Story

Applies to TestLeft 15.40, last modified on March 17, 2022

Let’s create a feature story for our JBehave test.

  1. Create the ‘resources’ folder in the src/test directory of your Java project. This folder will contain the feature files.

    Tip: You can place your feature files anywhere you want, but normally, they are stored in the src/test/resources project folder.
  2. In the resources folder, create a text file:

    Creating a text file

    Click the image to enlarge it.

    This file should have the .story extension. For example, you can use the name UndoFeature.story.

  3. Open the created file and write a feature story:

        Run the "Undo" command using hotkeys
        In order to check the undo functionality
        As a user
        I want Notepad to run the "Undo" command using the hotkeys Ctrl + z

    Scenario: Run the "Undo" command using hotkeys

    Given I open Notepad
    And there is no text in Notepad
    When I type "Some text"
    And I press [Ctrl + z]
    Then I should see no text in Notepad

    The feature story contains only one scenario: the user types “Some text” in the Notepad window and then presses Ctrl+Z to undo the action. Notepad should remove the typed text and show no text.

Prev     Next

See Also

Behavior-Driven Development
About Behavior-Driven Development

Highlight search results