diff --git a/pkg/tools/testing/reporter_test.go b/pkg/tools/testing/reporter_test.go index 5e9d645f..2429551b 100644 --- a/pkg/tools/testing/reporter_test.go +++ b/pkg/tools/testing/reporter_test.go @@ -10,8 +10,9 @@ func TestPrettyReporter(t *testing.T) { result := TestResult{ Info: []TestCaseInfo{ { - Name: "test_foo", - Duration: 1024, + Name: "test_foo", + Duration: 1024, + LogMessage: "log message", }, { Name: "test_bar", @@ -30,6 +31,7 @@ func TestPrettyReporter(t *testing.T) { } exp := `test_foo: PASS (1ms) +log message test_bar: FAIL (2ms) Error: assert failed -------------------------------------------------------------------------------- diff --git a/pkg/tools/testing/testing.go b/pkg/tools/testing/testing.go index ca288e58..771b0864 100644 --- a/pkg/tools/testing/testing.go +++ b/pkg/tools/testing/testing.go @@ -40,6 +40,9 @@ func (t *TestCaseInfo) Skip() bool { func (t *TestCaseInfo) Format() string { status := fmt.Sprintf("%s: %s (%dms)", t.Name, t.StatusString(), t.Duration/1000) + if t.LogMessage != "" { + return fmt.Sprintf("%s\n%s", status, t.LogMessage) + } if t.Fail() { return fmt.Sprintf("%s\n%s", status, t.ErrMessage) }