https://github.com/tsundberg/cucumber-datatables
A sample using Cucumber datatables
https://github.com/tsundberg/cucumber-datatables
cucumber-jvm datatable datatables java
Last synced: 3 months ago
JSON representation
A sample using Cucumber datatables
- Host: GitHub
- URL: https://github.com/tsundberg/cucumber-datatables
- Owner: tsundberg
- License: mit
- Created: 2017-12-11T11:30:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-11T12:09:59.000Z (over 7 years ago)
- Last Synced: 2025-01-05T13:42:24.439Z (5 months ago)
- Topics: cucumber-jvm, datatable, datatables, java
- Language: Java
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cucumber datatables
A sample using Cucumber data tables.It converts this data table
```
And the following day values
| day | num | denom | kpi |
| mon | 1 | 1 | cancellations |
| tue | 2 | 2 | cancellations |
| wed | 3 | 151 | cancellations |
```to a custom type that looks like this:
```
public class DayValue {
private String day;
private Integer num;
private Integer denom;
private String kpi;public DayValue(String day, Integer num, Integer denom, String kpi) {
this.day = day;
this.num = num;
this.denom = denom;
this.kpi = kpi;
}@Override
public String toString() {
return "DayValue{" +
"day='" + day + '\'' +
", num=" + num +
", denom=" + denom +
", kpi='" + kpi + '\'' +
'}';
}
}
```A step that can use this data table and custom type may look like this:
```
@Given("^the following day values$")
public void the_following_day_values(List dayValues) {
for (DayValue dayValue : dayValues) {
System.out.println(dayValue);
}
}
```More like this can be found at my blog at [Think Code AB](http://www.thinkcode.se/blog/category/Cucumber).
If you want to learn more about Behaviour-Driven Development (BDD) or Cucumber, please contact me at [[email protected]](mailto:[email protected])