Added datatables to cucumber json results files.

Этот коммит содержится в:
Clinton Bush 2019-03-14 22:47:48 -04:00
родитель c5e4234734
коммит 8242348e2a
2 изменённых файлов: 27 добавлений и 6 удалений

3
.gitignore предоставленный
Просмотреть файл

@ -1,2 +1,5 @@
/cmd/godog/godog
/example/example
**/vendor/*
Gopkg.lock
Gopkg.toml

Просмотреть файл

@ -71,12 +71,17 @@ type cukeMatch struct {
}
type cukeStep struct {
Keyword string `json:"keyword"`
Name string `json:"name"`
Line int `json:"line"`
Docstring *cukeDocstring `json:"doc_string,omitempty"`
Match cukeMatch `json:"match"`
Result cukeResult `json:"result"`
Keyword string `json:"keyword"`
Name string `json:"name"`
Line int `json:"line"`
Docstring *cukeDocstring `json:"doc_string,omitempty"`
Match cukeMatch `json:"match"`
Result cukeResult `json:"result"`
DataTable []*cukeDataTableRow `json:"rows,omitempty"`
}
type cukeDataTableRow struct {
Cells []string `json:"cells"`
}
type cukeElement struct {
@ -285,6 +290,19 @@ func (f *cukefmt) Defined(step *gherkin.Step, def *StepDef) {
f.curStep.Docstring.Value = step.Argument.(*gherkin.DocString).Content
}
if _, ok := step.Argument.(*gherkin.DataTable); ok {
dataTable := step.Argument.(*gherkin.DataTable)
f.curStep.DataTable = make([]*cukeDataTableRow, len(dataTable.Rows))
for i, row := range dataTable.Rows {
cells := make([]string, len(row.Cells))
for j, cell := range row.Cells {
cells[j] = cell.Value
}
f.curStep.DataTable[i] = &cukeDataTableRow{Cells: cells}
}
}
if def != nil {
f.curStep.Match.Location = strings.Split(def.definitionID(), " ")[0]
}