Skip to content

Commit 44d6374

Browse files
committed
Add Example and But keywords
1 parent a957121 commit 44d6374

5 files changed

Lines changed: 12 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.1.2] - More Gherkin keywords
2+
3+
* Add `Example` and `But` keywords
4+
15
## [0.1.1] - Hotfix
26

37
* Fix regular expressions for parameters parsing

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ Feature: Counter
6767

6868
Each feature file must have one or more `Feature:`s. Features become test groups in Flutter tests.
6969

70-
Each feature group must have one or more `Scenario:`s. Scenario become widget tests.
70+
Each feature group must have one or more `Scenario:`s (or `Example:`s). Scenario become widget tests.
7171

72-
Each scenario must have one or more lines. Each of them must start with `Given`, `When`, `Then`, or `And` keywords. Conventionally `Given` steps are used for test arrangements, `When` — for interaction, `Then` — for asserts.
72+
Each scenario must have one or more lines with steps. Each of them must start with `Given`, `When`, `Then`, `And`, or `But` keywords. Conventionally `Given` steps are used for test arrangements, `When` — for interaction, `Then` — for asserts. Keywords are not taken into account when looking for a step definition.
73+
You can have as many steps as you like, but it's recommended you keep the number at 3-5 per scenario. Having too many steps will cause it to lose it’s expressive power as specification and documentation.
7374

7475
## Predefined steps
7576

lib/src/bdd_line.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ LineType _lineTypeFromString(String line) {
2929
}
3030

3131
const featureMarkers = ['Feature:'];
32-
const scenarioMarkers = ['Scenario:'];
33-
const stepMarkers = ['Given', 'When', 'Then', 'And'];
32+
const scenarioMarkers = ['Scenario:', 'Example:'];
33+
const stepMarkers = ['Given', 'When', 'Then', 'And', 'But'];
3434

3535
String _removeLinePrefix(String rawLine) {
3636
final lines = rawLine.split(' ');

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: bdd_widget_test
22
description: A BDD-style widget testing library. Generates Flutter widget tests from *.feature files.
3-
version: 0.1.1
3+
version: 0.1.2
44
author: Oleksandr Leuschenko <olexa.le@gmail.com>
55
homepage: https://github.com/olexale/bdd_widget_test
66

test/testing_data.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Feature: Testing feature
1010
Given the app is running
1111
Then I see {'nice param'} text
1212
13-
And I see {Icons.add} icon
13+
But I see {Icons.add} icon
1414
''';
1515

1616
const bigFeatureFile = '''
@@ -22,7 +22,7 @@ Feature: First testing feature
2222
2323
Feature: Second testing feature
2424
25-
Scenario: First testing scenario
25+
Example: First testing scenario
2626
Given the app is running
2727
2828

0 commit comments

Comments
 (0)