File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 1
1
package suite
2
2
3
- import (
4
- "testing"
5
- "time"
6
- )
3
+ import "testing"
7
4
8
5
// TestingSuite can store and return the current *testing.T context
9
6
// generated by 'go test'.
@@ -39,11 +36,11 @@ type TearDownTestSuite interface {
39
36
// BeforeTest has a function to be executed right before the test
40
37
// starts and receives the suite and test names as input
41
38
type BeforeTest interface {
42
- BeforeTest (suiteName , testName string , when time. Time )
39
+ BeforeTest (suiteName , testName string )
43
40
}
44
41
45
42
// AfterTest has a function to be executed right after the test
46
43
// finishes and receives the suite and test names as input
47
44
type AfterTest interface {
48
- AfterTest (suiteName , testName string , when time. Time )
45
+ AfterTest (suiteName , testName string )
49
46
}
Original file line number Diff line number Diff line change 7
7
"reflect"
8
8
"regexp"
9
9
"testing"
10
- "time"
11
10
12
11
"github.com/stretchr/testify/assert"
13
12
"github.com/stretchr/testify/require"
@@ -88,11 +87,11 @@ func Run(t *testing.T, suite TestingSuite) {
88
87
setupTestSuite .SetupTest ()
89
88
}
90
89
if beforeTestSuite , ok := suite .(BeforeTest ); ok {
91
- beforeTestSuite .BeforeTest (methodFinder .Elem ().Name (), method .Name , time . Now () )
90
+ beforeTestSuite .BeforeTest (methodFinder .Elem ().Name (), method .Name )
92
91
}
93
92
defer func () {
94
93
if afterTestSuite , ok := suite .(AfterTest ); ok {
95
- afterTestSuite .AfterTest (methodFinder .Elem ().Name (), method .Name , time . Now () )
94
+ afterTestSuite .AfterTest (methodFinder .Elem ().Name (), method .Name )
96
95
}
97
96
if tearDownTestSuite , ok := suite .(TearDownTestSuite ); ok {
98
97
tearDownTestSuite .TearDownTest ()
Original file line number Diff line number Diff line change @@ -85,16 +85,16 @@ func (suite *SuiteTester) SetupSuite() {
85
85
suite .SetupSuiteRunCount ++
86
86
}
87
87
88
- func (suite * SuiteTester ) BeforeTest (suiteName , testName string , when time. Time ) {
88
+ func (suite * SuiteTester ) BeforeTest (suiteName , testName string ) {
89
89
suite .SuiteNameBefore = append (suite .SuiteNameBefore , suiteName )
90
90
suite .TestNameBefore = append (suite .TestNameBefore , testName )
91
- suite .TimeBefore = append (suite .TimeBefore , when )
91
+ suite .TimeBefore = append (suite .TimeBefore , time . Now () )
92
92
}
93
93
94
- func (suite * SuiteTester ) AfterTest (suiteName , testName string , when time. Time ) {
94
+ func (suite * SuiteTester ) AfterTest (suiteName , testName string ) {
95
95
suite .SuiteNameAfter = append (suite .SuiteNameAfter , suiteName )
96
96
suite .TestNameAfter = append (suite .TestNameAfter , testName )
97
- suite .TimeAfter = append (suite .TimeAfter , when )
97
+ suite .TimeAfter = append (suite .TimeAfter , time . Now () )
98
98
}
99
99
100
100
func (suite * SuiteSkipTester ) SetupSuite () {
You can’t perform that action at this time.
0 commit comments