Added datatables to cucumber json results files.
Этот коммит содержится в:
родитель
c5e4234734
коммит
8242348e2a
2 изменённых файлов: 27 добавлений и 6 удалений
3
.gitignore
предоставленный
3
.gitignore
предоставленный
|
@ -1,2 +1,5 @@
|
|||
/cmd/godog/godog
|
||||
/example/example
|
||||
**/vendor/*
|
||||
Gopkg.lock
|
||||
Gopkg.toml
|
||||
|
|
|
@ -77,6 +77,11 @@ type cukeStep struct {
|
|||
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]
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче