Remove timestamp from callback

pull/318/head
Esdras Beleza 2016-09-26 13:48:19 -03:00
parent bf7a93e70c
commit 5e72f93a89
3 changed files with 9 additions and 13 deletions

View File

@ -1,9 +1,6 @@
package suite
import (
"testing"
"time"
)
import "testing"
// TestingSuite can store and return the current *testing.T context
// generated by 'go test'.
@ -39,11 +36,11 @@ type TearDownTestSuite interface {
// BeforeTest has a function to be executed right before the test
// starts and receives the suite and test names as input
type BeforeTest interface {
BeforeTest(suiteName, testName string, when time.Time)
BeforeTest(suiteName, testName string)
}
// AfterTest has a function to be executed right after the test
// finishes and receives the suite and test names as input
type AfterTest interface {
AfterTest(suiteName, testName string, when time.Time)
AfterTest(suiteName, testName string)
}

View File

@ -7,7 +7,6 @@ import (
"reflect"
"regexp"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -88,11 +87,11 @@ func Run(t *testing.T, suite TestingSuite) {
setupTestSuite.SetupTest()
}
if beforeTestSuite, ok := suite.(BeforeTest); ok {
beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name, time.Now())
beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name)
}
defer func() {
if afterTestSuite, ok := suite.(AfterTest); ok {
afterTestSuite.AfterTest(methodFinder.Elem().Name(), method.Name, time.Now())
afterTestSuite.AfterTest(methodFinder.Elem().Name(), method.Name)
}
if tearDownTestSuite, ok := suite.(TearDownTestSuite); ok {
tearDownTestSuite.TearDownTest()

View File

@ -85,16 +85,16 @@ func (suite *SuiteTester) SetupSuite() {
suite.SetupSuiteRunCount++
}
func (suite *SuiteTester) BeforeTest(suiteName, testName string, when time.Time) {
func (suite *SuiteTester) BeforeTest(suiteName, testName string) {
suite.SuiteNameBefore = append(suite.SuiteNameBefore, suiteName)
suite.TestNameBefore = append(suite.TestNameBefore, testName)
suite.TimeBefore = append(suite.TimeBefore, when)
suite.TimeBefore = append(suite.TimeBefore, time.Now())
}
func (suite *SuiteTester) AfterTest(suiteName, testName string, when time.Time) {
func (suite *SuiteTester) AfterTest(suiteName, testName string) {
suite.SuiteNameAfter = append(suite.SuiteNameAfter, suiteName)
suite.TestNameAfter = append(suite.TestNameAfter, testName)
suite.TimeAfter = append(suite.TimeAfter, when)
suite.TimeAfter = append(suite.TimeAfter, time.Now())
}
func (suite *SuiteSkipTester) SetupSuite() {