mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 14:29:44 +08:00
init HttpBommer ✨🍰✨
This commit is contained in:
37
runner_test.go
Normal file
37
runner_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user