fix unittest TestRunCaseWithTimeout

This commit is contained in:
lilong.129
2023-04-19 16:20:56 +08:00
parent 60709272ee
commit 90cea61c32
+6 -6
View File
@@ -164,7 +164,7 @@ func TestRunCaseWithTimeout(t *testing.T) {
// global timeout // global timeout
testcase1 := &TestCase{ testcase1 := &TestCase{
Config: NewConfig("TestCase1"). Config: NewConfig("TestCase1").
SetTimeout(2 * time.Second). // set global timeout to 2s SetTimeout(10 * time.Second). // set global timeout to 10s
SetBaseURL("https://httpbin.org"), SetBaseURL("https://httpbin.org"),
TestSteps: []IStep{ TestSteps: []IStep{
NewStep("step1"). NewStep("step1").
@@ -180,11 +180,11 @@ func TestRunCaseWithTimeout(t *testing.T) {
testcase2 := &TestCase{ testcase2 := &TestCase{
Config: NewConfig("TestCase2"). Config: NewConfig("TestCase2").
SetTimeout(2 * time.Second). // set global timeout to 2s SetTimeout(10 * time.Second). // set global timeout to 10s
SetBaseURL("https://httpbin.org"), SetBaseURL("https://httpbin.org"),
TestSteps: []IStep{ TestSteps: []IStep{
NewStep("step1"). NewStep("step1").
GET("/delay/3"). GET("/delay/11").
Validate(). Validate().
AssertEqual("status_code", 200, "check status code"), AssertEqual("status_code", 200, "check status code"),
}, },
@@ -197,12 +197,12 @@ func TestRunCaseWithTimeout(t *testing.T) {
// step timeout // step timeout
testcase3 := &TestCase{ testcase3 := &TestCase{
Config: NewConfig("TestCase3"). Config: NewConfig("TestCase3").
SetTimeout(2 * time.Second). SetTimeout(10 * time.Second).
SetBaseURL("https://httpbin.org"), SetBaseURL("https://httpbin.org"),
TestSteps: []IStep{ TestSteps: []IStep{
NewStep("step2"). NewStep("step2").
GET("/delay/3"). GET("/delay/11").
SetTimeout(4*time.Second). // set step timeout to 4s SetTimeout(15*time.Second). // set step timeout to 4s
Validate(). Validate().
AssertEqual("status_code", 200, "check status code"), AssertEqual("status_code", 200, "check status code"),
}, },