PyCharm 2024.1 Help

Create examples table in scenario outline


PyCharm provides support for scenario outlines, enabling you to describe multiple scenarios by means of templates with placeholders. This support includes:

  • Code completion Ctrl+Space for keywords.

  • Syntax highlighting for keywords, placeholders, and attributes.

  • Code inspection to detect missing examples, and a quick fix for generating Examples table stub.

Creating Examples table

To create Examples table for a scenario outline, follow these general steps

  1. Having created a feature file, type the desired scenario outline. Use angle brackets to enclose placeholders. If the steps are not defined, create step definitions. Since the Examples section is missing, PyCharm marks Scenario Outline name as an error.

    Writing a scenario outline
  2. Press Alt+Enter to show the suggested intention action, and press Enter:

    Using intention to create examples
  3. Add the desired rows to the Examples table:

    Adding rows to the Examples table

    As you add rows, the columns in the Examples section are aligned automatically.

    Note highlighting of the placeholders, and the values in the Examples table, which will be substituted on running examples.

Tips and tricks

  • If a colon is missing after the keyword Examples, it is recognized and marked as a syntax error, and a quick fix suggests to create colon.

  • You can add textual notes to the steps of a scenario outline. Such notes should be enclosed in triple quotes; in this case, PyCharm perceives the text inside as a string, and displays it when running the scenario step:

    Using text notes within a scenario
Last modified: 11 February 2024