| 555 | } |
| 556 | |
| 557 | func TestSuiteWithStats(t *testing.T) { |
| 558 | suiteWithStats := new(suiteWithStats) |
| 559 | |
| 560 | suiteSuccess := testing.RunTests(allTestsFilter, []testing.InternalTest{ |
| 561 | { |
| 562 | Name: t.Name() + "/suiteWithStats", |
| 563 | F: func(t *testing.T) { |
| 564 | Run(t, suiteWithStats) |
| 565 | }, |
| 566 | }, |
| 567 | }) |
| 568 | require.False(t, suiteSuccess, "suiteWithStats should report test failure because of panic in TestPanic") |
| 569 | |
| 570 | assert.True(t, suiteWithStats.wasCalled) |
| 571 | assert.NotZero(t, suiteWithStats.stats.Start) |
| 572 | assert.NotZero(t, suiteWithStats.stats.End) |
| 573 | assert.False(t, suiteWithStats.stats.Passed()) |
| 574 | |
| 575 | testStats := suiteWithStats.stats.TestStats |
| 576 | |
| 577 | assert.NotZero(t, testStats["TestSomething"].Start) |
| 578 | assert.NotZero(t, testStats["TestSomething"].End) |
| 579 | assert.True(t, testStats["TestSomething"].Passed) |
| 580 | |
| 581 | assert.NotZero(t, testStats["TestPanic"].Start) |
| 582 | assert.NotZero(t, testStats["TestPanic"].End) |
| 583 | assert.False(t, testStats["TestPanic"].Passed) |
| 584 | } |
| 585 | |
| 586 | // FailfastSuite will test the behavior when running with the failfast flag |
| 587 | // It logs calls in the callOrder slice which we then use to assert the correct calls were made |