github.com/wfusion/gofusion@v1.1.14/test/common/utils/cases/string_test.go (about) 1 package cases 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/stretchr/testify/suite" 8 9 "github.com/wfusion/gofusion/common/utils" 10 "github.com/wfusion/gofusion/log" 11 12 testUtl "github.com/wfusion/gofusion/test/common/utils" 13 ) 14 15 func TestString(t *testing.T) { 16 t.Parallel() 17 testingSuite := &String{Test: new(testUtl.Test)} 18 suite.Run(t, testingSuite) 19 } 20 21 type String struct { 22 *testUtl.Test 23 } 24 25 func (t *String) BeforeTest(suiteName, testName string) { 26 t.Catch(func() { 27 log.Info(context.Background(), "right before %s %s", suiteName, testName) 28 }) 29 } 30 31 func (t *String) AfterTest(suiteName, testName string) { 32 t.Catch(func() { 33 log.Info(context.Background(), "right after %s %s", suiteName, testName) 34 }) 35 } 36 37 func (t *String) TestFuzzyKeyword() { 38 t.Catch(func() { 39 keyword := "user_id" 40 fuzzs := utils.FuzzyKeyword(keyword) 41 t.Greater(len(fuzzs), 1) 42 }) 43 }