mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
feat: quit boomer test
This commit is contained in:
@@ -36,6 +36,10 @@ func (b *Boomer) Run(testcases ...ITestCase) {
|
|||||||
b.Boomer.Run(taskSlice...)
|
b.Boomer.Run(taskSlice...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Boomer) Quit() {
|
||||||
|
b.Boomer.Quit()
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Boomer) convertBoomerTask(testcase *TestCase) *boomer.Task {
|
func (b *Boomer) convertBoomerTask(testcase *TestCase) *boomer.Task {
|
||||||
runner := NewRunner(nil).SetDebug(b.debug)
|
runner := NewRunner(nil).SetDebug(b.debug)
|
||||||
return &boomer.Task{
|
return &boomer.Task{
|
||||||
|
|||||||
+26
-14
@@ -2,21 +2,33 @@ package hrp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHttpBoomer(t *testing.T) {
|
func TestBoomerStandaloneRun(t *testing.T) {
|
||||||
// testcase1 := &TestCase{
|
testcase1 := &TestCase{
|
||||||
// Config: TConfig{
|
Config: TConfig{
|
||||||
// Name: "TestCase1",
|
Name: "TestCase1",
|
||||||
// Weight: 2,
|
BaseURL: "http://httpbin.org",
|
||||||
// },
|
},
|
||||||
// }
|
TestSteps: []IStep{
|
||||||
// testcase2 := &TestCase{
|
Step("headers").
|
||||||
// Config: TConfig{
|
GET("/headers").
|
||||||
// Name: "TestCase2",
|
Validate().
|
||||||
// Weight: 3,
|
AssertEqual("status_code", 200, "check status code").
|
||||||
// },
|
AssertEqual("headers.\"Content-Type\"", "application/json", "check http response Content-Type"),
|
||||||
// }
|
Step("user-agent").
|
||||||
|
GET("/user-agent").
|
||||||
|
Validate().
|
||||||
|
AssertEqual("status_code", 200, "check status code").
|
||||||
|
AssertEqual("headers.\"Content-Type\"", "application/json", "check http response Content-Type"),
|
||||||
|
Step("TestCase3").CallRefCase(&TestCase{Config: TConfig{Name: "TestCase3"}}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
testcase2 := &TestCasePath{demoTestCaseJSONPath}
|
||||||
|
|
||||||
// NewStandaloneBoomer(1, 1).Run(testcase1, testcase2)
|
b := NewStandaloneBoomer(2, 1)
|
||||||
|
go b.Run(testcase1, testcase2)
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
b.Quit()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user