Running Mode¶
Currently, boomer has two running mode, standalone and distributed.
Distributed¶
When running in distributed mode, boomer will connect to a locust master and running as a slave. It’s the default running mode of boomer.
Standalone¶
When running in standalone mode, boomer doesn’t need to connect to a locust master and start testing immediately.
By default, the standalone mode works with a ConsoleOutput, which will print the test result to the console, you can write you own output and add more by calling boomer.AddOutput().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | package main
import (
"log"
"time"
"github.com/myzhan/boomer"
)
func foo() {
start := time.Now()
time.Sleep(100 * time.Millisecond)
elapsed := time.Since(start)
// Report your test result as a success, if you write it in python, it will looks like this
// events.request_success.fire(request_type="http", name="foo", response_time=100, response_length=10)
globalBoomer.RecordSuccess("http", "foo", elapsed.Nanoseconds()/int64(time.Millisecond), int64(10))
}
var globalBoomer *boomer.Boomer
func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
task1 := &boomer.Task{
Name: "foo",
Weight: 10,
Fn: foo,
}
numClients := 10
spawnRate := 10
globalBoomer = boomer.NewStandaloneBoomer(numClients, spawnRate)
globalBoomer.Run(task1)
}
|