init HttpBommer 🍰

This commit is contained in:
debugtalk
2021-09-19 13:20:22 +08:00
parent 6f824ea1cf
commit 6b7955a955
15 changed files with 561 additions and 1 deletions

37
runner_test.go Normal file
View File

@@ -0,0 +1,37 @@
package httpboomer
import (
"testing"
)
func TestHttpRunner(t *testing.T) {
testcase1 := &TestCase{
Config: TConfig{
Name: "TestCase1",
BaseURL: "http://httpbin.org",
},
TestSteps: []IStep{
RunRequest("headers").
GET("/headers").
Validate().
AssertEqual("status_code", 200, "check status code").
AssertEqual("headers.Host", "httpbin.org", "check http response host"),
RunRequest("user-agent").
GET("/user-agent").
Validate().
AssertEqual("status_code", 200, "check status code").
AssertEqual("body.\"user-agent\"", "python-requests", "check User-Agent"),
},
}
testcase2 := &TestCase{
Config: TConfig{
Name: "TestCase2",
Weight: 3,
},
}
err := HttpRunner().Run(testcase1, testcase2)
if err != nil {
t.Fatalf("run testcase error: %v", err)
}
}