mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 06:23:52 +08:00
fix: unittest
This commit is contained in:
@@ -185,6 +185,7 @@ func TestCaseDemo(t *testing.T) {
|
|||||||
"varFoo2": "${max($a, $b)}", // 12.3; eval with built-in function
|
"varFoo2": "${max($a, $b)}", // 12.3; eval with built-in function
|
||||||
}),
|
}),
|
||||||
TestSteps: []hrp.IStep{
|
TestSteps: []hrp.IStep{
|
||||||
|
hrp.NewStep("transaction 1 start").StartTransaction("tran1"), // start transaction
|
||||||
hrp.NewStep("get with params").
|
hrp.NewStep("get with params").
|
||||||
WithVariables(map[string]interface{}{ // step level variables
|
WithVariables(map[string]interface{}{ // step level variables
|
||||||
"n": 3, // inherit config level variables if not set in step level, a/varFoo1
|
"n": 3, // inherit config level variables if not set in step level, a/varFoo1
|
||||||
@@ -202,6 +203,7 @@ func TestCaseDemo(t *testing.T) {
|
|||||||
AssertLengthEqual("body.args.foo1", 5, "check args foo1"). // validate response body with jmespath
|
AssertLengthEqual("body.args.foo1", 5, "check args foo1"). // validate response body with jmespath
|
||||||
AssertLengthEqual("$varFoo1", 5, "check args foo1"). // assert with extracted variable from current step
|
AssertLengthEqual("$varFoo1", 5, "check args foo1"). // assert with extracted variable from current step
|
||||||
AssertEqual("body.args.foo2", "34.5", "check args foo2"), // notice: request params value will be converted to string
|
AssertEqual("body.args.foo2", "34.5", "check args foo2"), // notice: request params value will be converted to string
|
||||||
|
hrp.NewStep("transaction 1 end").EndTransaction("tran1"), // end transaction
|
||||||
hrp.NewStep("post json data").
|
hrp.NewStep("post json data").
|
||||||
POST("/post").
|
POST("/post").
|
||||||
WithBody(map[string]interface{}{
|
WithBody(map[string]interface{}{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (b *Boomer) SetRateLimiter(maxRPS int64, requestIncreaseRate string) {
|
|||||||
maxRPS = math.MaxInt64
|
maxRPS = math.MaxInt64
|
||||||
}
|
}
|
||||||
log.Warn().Int64("maxRPS", maxRPS).Str("increaseRate", requestIncreaseRate).Msg("set ramp up rate limiter")
|
log.Warn().Int64("maxRPS", maxRPS).Str("increaseRate", requestIncreaseRate).Msg("set ramp up rate limiter")
|
||||||
rateLimiter, err = NewRampUpRateLimiter(math.MaxInt64, requestIncreaseRate, time.Second)
|
rateLimiter, err = NewRampUpRateLimiter(maxRPS, requestIncreaseRate, time.Second)
|
||||||
} else {
|
} else {
|
||||||
if maxRPS > 0 {
|
if maxRPS > 0 {
|
||||||
log.Warn().Int64("maxRPS", maxRPS).Msg("set stable rate limiter")
|
log.Warn().Int64("maxRPS", maxRPS).Msg("set stable rate limiter")
|
||||||
|
|||||||
Reference in New Issue
Block a user