Skip to content

Commit 8669df0

Browse files
authored
English Keywords: Scenario Template, Scenarios (#117)
* added Scenario Template and Scenarios keyword * updated tests * updated docs * updated CHANGELOG
1 parent 272981a commit 8669df0

5 files changed

Lines changed: 27 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- Scenario filtering by name with the program option `-n`/`--name`, including placeholders (*) and single-character (?) matching ([107](https://github.com/ThoSe1990/cwt-cucumber/pull/107))
8+
- English keywords: `Scenario Template` and `Scenarios` ([117](https://github.com/ThoSe1990/cwt-cucumber/pull/117))
89

910
### Fixed
1011

docs/chapters/cucumber_features.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Alternatively, you can use the universal **\*** keyword.
4343
4444
Scenarios are independent from one another and are executed in isolation.
4545

46-
Scenario Outlines
47-
-----------------
46+
Scenario Outline / Scenario Template
47+
------------------------------------
4848

49-
A *Scenario Outline* allows you to run the same scenario multiple times with different data sets.
50-
Placeholders inside the scenario are replaced by values defined in the ``Examples`` table.
49+
A *Scenario Outline* (or *Scenario Template*) allows you to run the same scenario multiple times with different data sets.
50+
Placeholders inside the scenario are replaced by values defined in the ``Examples`` (or ``Scenarios``) table.
5151

5252
.. code-block:: gherkin
5353

examples/features/2_scenario_outline.feature

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,13 @@ Feature: Examples - Scenario Outline
1010
| count | item |
1111
| 1 | "apple" |
1212
| 2 | "bananas" |
13-
| 3 | "gherkins" |
1413

14+
Scenario Template: Alternative Keywords
15+
Given An empty box
16+
When I place <count> x <item> in it
17+
Then The box contains <count> items
18+
19+
Scenarios:
20+
| count | item |
21+
| 1 | "pen" |
22+
| 3 | "collegeblocks" |

gtest/scanner_english.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ TEST(english_keywords, scenario_outline)
1717
EXPECT_EQ(scanner("Scenario Outline:").scan_token().type,
1818
token_type::scenario_outline);
1919
}
20+
TEST(english_keywords, scenario_template)
21+
{
22+
EXPECT_EQ(scanner("Scenario Template:").scan_token().type,
23+
token_type::scenario_outline);
24+
}
2025
TEST(english_keywords, background)
2126
{
2227
EXPECT_EQ(scanner("Background:").scan_token().type, token_type::background);
@@ -25,6 +30,10 @@ TEST(english_keywords, examples)
2530
{
2631
EXPECT_EQ(scanner("Examples:").scan_token().type, token_type::examples);
2732
}
33+
TEST(english_keywords, scenarios)
34+
{
35+
EXPECT_EQ(scanner("Scenarios:").scan_token().type, token_type::examples);
36+
}
2837
TEST(english_keywords, given)
2938
{
3039
EXPECT_EQ(scanner("Given").scan_token().type, token_type::step);

src/identifiers/english.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ class english : public identifier
2424
}
2525

2626
private:
27-
static constexpr std::array<std::pair<std::string_view, token_type>, 12>
27+
static constexpr std::array<std::pair<std::string_view, token_type>, 14>
2828
m_identifiers{{{std::string_view("Feature:"), token_type::feature},
2929
{std::string_view("Scenario:"), token_type::scenario},
3030
{std::string_view("Example:"), token_type::scenario},
3131
{std::string_view("Scenario Outline:"),
3232
token_type::scenario_outline},
33+
{std::string_view("Scenario Template:"),
34+
token_type::scenario_outline},
3335
{std::string_view("Rule:"), token_type::rule},
3436
{std::string_view("Background:"), token_type::background},
3537
{std::string_view("Examples:"), token_type::examples},
38+
{std::string_view("Scenarios:"), token_type::examples},
3639
{std::string_view("Given"), token_type::step},
3740
{std::string_view("When"), token_type::step},
3841
{std::string_view("Then"), token_type::step},

0 commit comments

Comments
 (0)