mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 19:39:44 +08:00
feat: support set debug for boomer
This commit is contained in:
15
boomer.go
15
boomer.go
@@ -13,23 +13,32 @@ func Run(testcases ...*TestCase) {
|
||||
}
|
||||
|
||||
func NewBoomer() *Boomer {
|
||||
return &Boomer{}
|
||||
return &Boomer{
|
||||
debug: false,
|
||||
}
|
||||
}
|
||||
|
||||
type Boomer struct {
|
||||
debug bool
|
||||
}
|
||||
|
||||
func (b *Boomer) SetDebug(debug bool) *Boomer {
|
||||
b.debug = debug
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *Boomer) Run(testcases ...*TestCase) {
|
||||
var taskSlice []*boomer.Task
|
||||
for _, testcase := range testcases {
|
||||
task := convertBoomerTask(testcase)
|
||||
task := b.convertBoomerTask(testcase)
|
||||
taskSlice = append(taskSlice, task)
|
||||
}
|
||||
boomer.Run(taskSlice...)
|
||||
}
|
||||
|
||||
func convertBoomerTask(testcase *TestCase) *boomer.Task {
|
||||
func (b *Boomer) convertBoomerTask(testcase *TestCase) *boomer.Task {
|
||||
runner := NewRunner()
|
||||
runner = runner.SetDebug(b.debug)
|
||||
return &boomer.Task{
|
||||
Name: testcase.Config.Name,
|
||||
Weight: testcase.Config.Weight,
|
||||
|
||||
Reference in New Issue
Block a user