mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-17 10:27:35 +08:00
feat: call function
This commit is contained in:
@@ -2,6 +2,7 @@ package httpboomer
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -278,3 +279,16 @@ func TestMergeVariables(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestCallFunction(t *testing.T) {
|
||||
funcName := "sleep"
|
||||
params := []interface{}{1}
|
||||
timeStart := time.Now()
|
||||
_, err := callFunction(funcName, params)
|
||||
if !assert.Nil(t, err) {
|
||||
t.Fail()
|
||||
}
|
||||
if !assert.Greater(t, time.Since(timeStart), time.Duration(1)*time.Second) {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user