
* fix(formatter): add onflush logger only print output at end of scenario when running concurrently * add to changelog * fix tests * fix scenario outline output for the Pretty formatter * fix casing for linter * add coverage for new storage function * relate suite back to where it was originally * better type assertion on flush log * var name for asserted formatter that doesn't clash with stdlib's fmt * add coverage to summary * only defer flush func when running concurrently * much more concise way of deferring the flush --------- Co-authored-by: Viacheslav Poturaev <vearutop@gmail.com>
53 строки
1,6 КиБ
Go
53 строки
1,6 КиБ
Go
package formatters
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
var flushMock = DummyFormatter{}
|
|
|
|
func TestFlushWrapOnFormatter(t *testing.T) {
|
|
flushMock.tt = t
|
|
|
|
fmt := WrapOnFlush(&flushMock)
|
|
|
|
fmt.Feature(document, str, byt)
|
|
fmt.TestRunStarted()
|
|
fmt.Pickle(pickle)
|
|
fmt.Defined(pickle, step, definition)
|
|
fmt.Passed(pickle, step, definition)
|
|
fmt.Skipped(pickle, step, definition)
|
|
fmt.Undefined(pickle, step, definition)
|
|
fmt.Failed(pickle, step, definition, err)
|
|
fmt.Pending(pickle, step, definition)
|
|
fmt.Ambiguous(pickle, step, definition, err)
|
|
fmt.Summary()
|
|
|
|
assert.Equal(t, 0, flushMock.CountFeature)
|
|
assert.Equal(t, 0, flushMock.CountTestRunStarted)
|
|
assert.Equal(t, 0, flushMock.CountPickle)
|
|
assert.Equal(t, 0, flushMock.CountDefined)
|
|
assert.Equal(t, 0, flushMock.CountPassed)
|
|
assert.Equal(t, 0, flushMock.CountSkipped)
|
|
assert.Equal(t, 0, flushMock.CountUndefined)
|
|
assert.Equal(t, 0, flushMock.CountFailed)
|
|
assert.Equal(t, 0, flushMock.CountPending)
|
|
assert.Equal(t, 0, flushMock.CountAmbiguous)
|
|
assert.Equal(t, 0, flushMock.CountSummary)
|
|
|
|
fmt.Flush()
|
|
|
|
assert.Equal(t, 1, flushMock.CountFeature)
|
|
assert.Equal(t, 1, flushMock.CountTestRunStarted)
|
|
assert.Equal(t, 1, flushMock.CountPickle)
|
|
assert.Equal(t, 1, flushMock.CountDefined)
|
|
assert.Equal(t, 1, flushMock.CountPassed)
|
|
assert.Equal(t, 1, flushMock.CountSkipped)
|
|
assert.Equal(t, 1, flushMock.CountUndefined)
|
|
assert.Equal(t, 1, flushMock.CountFailed)
|
|
assert.Equal(t, 1, flushMock.CountPending)
|
|
assert.Equal(t, 1, flushMock.CountAmbiguous)
|
|
assert.Equal(t, 1, flushMock.CountSummary)
|
|
}
|