MCPcopy
hub / github.com/stretchr/testify / TestSuiteWithStats

Function TestSuiteWithStats

suite/suite_test.go:557–584  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

555}
556
557func 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

Callers

nothing calls this directly

Calls 7

FalseFunction · 0.92
TrueFunction · 0.92
NotZeroFunction · 0.92
FalseFunction · 0.92
RunFunction · 0.85
PassedMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected