You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,6 +125,38 @@ Feature: Sample
125
125
ThenI see {'Do not forget your towel!'} text
126
126
```
127
127
128
+
While the `DataTable`-like syntax is a good practice for scenarios that require repeated steps, for example, entering text in different fields, sometimes we want to prepare test data in a readable way and mock our scneario's prerequisites and assert the expected result in an explicit domain driven way.
129
+
To handle this, we create a data table:
130
+
```ruby
131
+
Feature:Search songs
132
+
133
+
Scenario:Searched text matches a song's details
134
+
Given available songs
135
+
| 'artist' | 'name' |
136
+
| 'TheDoors' | 'Riders on the storm' |
137
+
| 'BobDylan' | "Knockin'OnHeaven's Door" |
138
+
| 'TheBeatles' | 'HereComes the Sun' |
139
+
When I search for text {'door'}
140
+
Then I see songs
141
+
| 'artist' | 'name' |
142
+
| 'TheDoors' | 'Riders on the storm' |
143
+
| 'BobDylan' | "Knockin'OnHeaven's Door" |
144
+
```
145
+
For each of the above step lines that are followed by a table, in the related generate step file, the created function will have an object parameter of type `DataTable`:
146
+
```dart
147
+
import 'package:bdd_widget_test/data_table.dart' as bdd;
0 commit comments