Added datatables to cucumber json results files.
Этот коммит содержится в:
родитель
c5e4234734
коммит
8242348e2a
2 изменённых файлов: 27 добавлений и 6 удалений
3
.gitignore
предоставленный
3
.gitignore
предоставленный
|
@ -1,2 +1,5 @@
|
||||||
/cmd/godog/godog
|
/cmd/godog/godog
|
||||||
/example/example
|
/example/example
|
||||||
|
**/vendor/*
|
||||||
|
Gopkg.lock
|
||||||
|
Gopkg.toml
|
||||||
|
|
|
@ -71,12 +71,17 @@ type cukeMatch struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type cukeStep struct {
|
type cukeStep struct {
|
||||||
Keyword string `json:"keyword"`
|
Keyword string `json:"keyword"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Line int `json:"line"`
|
Line int `json:"line"`
|
||||||
Docstring *cukeDocstring `json:"doc_string,omitempty"`
|
Docstring *cukeDocstring `json:"doc_string,omitempty"`
|
||||||
Match cukeMatch `json:"match"`
|
Match cukeMatch `json:"match"`
|
||||||
Result cukeResult `json:"result"`
|
Result cukeResult `json:"result"`
|
||||||
|
DataTable []*cukeDataTableRow `json:"rows,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type cukeDataTableRow struct {
|
||||||
|
Cells []string `json:"cells"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type cukeElement struct {
|
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
|
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 {
|
if def != nil {
|
||||||
f.curStep.Match.Location = strings.Split(def.definitionID(), " ")[0]
|
f.curStep.Match.Location = strings.Split(def.definitionID(), " ")[0]
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче