fix: record all requests of testcase reference in boom mode

This commit is contained in:
xucong053
2022-07-01 11:53:27 +08:00
parent ee8cfcae86
commit 6a40da46e0
3 changed files with 21 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
# NOTE: Generated By hrp v4.1.4, DO NOT EDIT!
# NOTE: Generated By hrp v4.1.5, DO NOT EDIT!
import sys
import os

View File

@@ -136,7 +136,20 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
b.Boomer.ResetStartTime()
})
stepResult, err := step.Run(sessionRunner)
// update step result name with parsed step name
stepResult.Name = stepName
// record requests result of the step if step type is testcase
if stepResult.StepType == stepTypeTestCase && stepResult.Data != nil {
// record requests of testcase step
for _, result := range stepResult.Data.([]*StepResult) {
if result.Success {
b.RecordSuccess(string(result.StepType), result.Name, result.Elapsed, result.ContentSize)
} else {
b.RecordFailure(string(result.StepType), result.Name, result.Elapsed, result.Attachment)
}
}
}
// record step failure
if err != nil {
// step failed
var elapsed int64
@@ -157,7 +170,7 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
continue
}
// step success
// record step success
if stepResult.StepType == stepTypeTransaction {
// transaction
// FIXME: support nested transactions

View File

@@ -74,12 +74,16 @@ func (s *requestStats) logTransaction(name string, success bool, responseTime in
}
func (s *requestStats) logRequest(method, name string, responseTime int64, contentLength int64) {
s.total.log(responseTime, contentLength)
if method != "testcase" {
s.total.log(responseTime, contentLength)
}
s.get(name, method).log(responseTime, contentLength)
}
func (s *requestStats) logError(method, name, err string) {
s.total.logFailures()
if method != "testcase" {
s.total.logFailures()
}
s.get(name, method).logFailures()
// store error in errors map