mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-01 22:09:35 +08:00
refactor: NewConfig
This commit is contained in:
@@ -6,10 +6,8 @@ import (
|
||||
|
||||
func TestHttpRunner(t *testing.T) {
|
||||
testcase1 := &TestCase{
|
||||
Config: TConfig{
|
||||
Name: "TestCase1",
|
||||
BaseURL: "http://httpbin.org",
|
||||
},
|
||||
Config: NewConfig("TestCase1").
|
||||
SetBaseURL("http://httpbin.org"),
|
||||
TestSteps: []IStep{
|
||||
NewStep("headers").
|
||||
GET("/headers").
|
||||
@@ -21,14 +19,11 @@ func TestHttpRunner(t *testing.T) {
|
||||
Validate().
|
||||
AssertEqual("status_code", 200, "check status code").
|
||||
AssertEqual("headers.\"Content-Type\"", "application/json", "check http response Content-Type"),
|
||||
NewStep("TestCase3").CallRefCase(&TestCase{Config: TConfig{Name: "TestCase3"}}),
|
||||
NewStep("TestCase3").CallRefCase(&TestCase{Config: NewConfig("TestCase3")}),
|
||||
},
|
||||
}
|
||||
testcase2 := &TestCase{
|
||||
Config: TConfig{
|
||||
Name: "TestCase2",
|
||||
Weight: 3,
|
||||
},
|
||||
Config: NewConfig("TestCase2").SetWeight(3),
|
||||
}
|
||||
testcase3 := &TestCasePath{demoTestCaseJSONPath}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user