
* added basic detection for ambiguous steps, but causes an error and not yet recorded in the reports as 'Ambiguous', and no test cases figured out yet * added initial support for detection of ambiguous steps - further work take a look at how cuke jvm report ambiguous steps and sets the step status to 'ambiguous' rather than my current solution which just blows the test up as a regular step error * added suite_context_test and also introduced missing 'ambiguous' status to make cucumber jvm' * update CHANGELOG for ambiguous step defs * missed file from commit * added internal/formatters/fmt_multi_test.go * add tests for other peoples code * added "ambigous" to the help text * tests * added some more tests for attachments * Update internal/flags/flags.go Co-authored-by: Viacheslav Poturaev <nanopeni@gmail.com> --------- Co-authored-by: Viacheslav Poturaev <nanopeni@gmail.com>
111 строки
1,8 КиБ
Go
111 строки
1,8 КиБ
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/cucumber/godog/colors"
|
|
"github.com/cucumber/godog/internal/utils"
|
|
)
|
|
|
|
// TestRunStarted ...
|
|
type TestRunStarted struct {
|
|
StartedAt time.Time
|
|
}
|
|
|
|
// PickleResult ...
|
|
type PickleResult struct {
|
|
PickleID string
|
|
StartedAt time.Time
|
|
}
|
|
|
|
// PickleAttachment ...
|
|
type PickleAttachment struct {
|
|
Name string
|
|
MimeType string
|
|
Data []byte
|
|
}
|
|
|
|
// PickleStepResult ...
|
|
type PickleStepResult struct {
|
|
Status StepResultStatus
|
|
FinishedAt time.Time
|
|
Err error
|
|
|
|
PickleID string
|
|
PickleStepID string
|
|
|
|
Def *StepDefinition
|
|
|
|
Attachments []PickleAttachment
|
|
}
|
|
|
|
// NewStepResult ...
|
|
func NewStepResult(
|
|
status StepResultStatus,
|
|
pickleID, pickleStepID string,
|
|
match *StepDefinition,
|
|
attachments []PickleAttachment,
|
|
err error,
|
|
) PickleStepResult {
|
|
return PickleStepResult{
|
|
Status: status,
|
|
FinishedAt: utils.TimeNowFunc(),
|
|
Err: err,
|
|
PickleID: pickleID,
|
|
PickleStepID: pickleStepID,
|
|
Def: match,
|
|
Attachments: attachments,
|
|
}
|
|
}
|
|
|
|
// StepResultStatus ...
|
|
type StepResultStatus int
|
|
|
|
const (
|
|
// Passed ...
|
|
Passed StepResultStatus = iota
|
|
// Failed ...
|
|
Failed
|
|
// Skipped ...
|
|
Skipped
|
|
// Undefined ...
|
|
Undefined
|
|
// Pending ...
|
|
Pending
|
|
// Ambiguous ...
|
|
Ambiguous
|
|
)
|
|
|
|
// Color ...
|
|
func (st StepResultStatus) Color() colors.ColorFunc {
|
|
switch st {
|
|
case Passed:
|
|
return colors.Green
|
|
case Failed:
|
|
return colors.Red
|
|
case Skipped:
|
|
return colors.Cyan
|
|
default:
|
|
return colors.Yellow
|
|
}
|
|
}
|
|
|
|
// String ...
|
|
func (st StepResultStatus) String() string {
|
|
switch st {
|
|
case Passed:
|
|
return "passed"
|
|
case Failed:
|
|
return "failed"
|
|
case Skipped:
|
|
return "skipped"
|
|
case Undefined:
|
|
return "undefined"
|
|
case Pending:
|
|
return "pending"
|
|
case Ambiguous:
|
|
return "ambiguous"
|
|
default:
|
|
return "unknown"
|
|
}
|
|
}
|