docs: add docs for IStep

This commit is contained in:
debugtalk
2022-03-30 16:56:31 +08:00
parent a92820a3b1
commit d08368ad17
11 changed files with 107 additions and 11 deletions

View File

@@ -147,7 +147,7 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
if stepResult.StepType == stepTypeTransaction {
// transaction
// FIXME: support nested transactions
if step.ToStruct().Transaction.Type == transactionEnd { // only record when transaction ends
if step.Struct().Transaction.Type == transactionEnd { // only record when transaction ends
b.RecordTransaction(stepResult.Name, transactionSuccess, stepResult.Elapsed, 0)
transactionSuccess = true // reset flag for next transaction
}

View File

@@ -47,6 +47,6 @@ type TStep struct {
type IStep interface {
Name() string
Type() StepType
ToStruct() *TStep
Struct() *TStep
Run(*SessionRunner) (*StepResult, error)
}

View File

@@ -88,7 +88,7 @@ func (s *StepAPIWithOptionalArgs) Type() StepType {
return stepTypeAPI
}
func (s *StepAPIWithOptionalArgs) ToStruct() *TStep {
func (s *StepAPIWithOptionalArgs) Struct() *TStep {
return s.step
}

View File

@@ -24,7 +24,7 @@ func (s *StepRendezvous) Type() StepType {
return stepTypeRendezvous
}
func (s *StepRendezvous) ToStruct() *TStep {
func (s *StepRendezvous) Struct() *TStep {
return s.step
}

View File

@@ -703,7 +703,7 @@ func (s *StepRequestWithOptionalArgs) Type() StepType {
return StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
}
func (s *StepRequestWithOptionalArgs) ToStruct() *TStep {
func (s *StepRequestWithOptionalArgs) Struct() *TStep {
return s.step
}
@@ -737,7 +737,7 @@ func (s *StepRequestExtraction) Type() StepType {
return StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
}
func (s *StepRequestExtraction) ToStruct() *TStep {
func (s *StepRequestExtraction) Struct() *TStep {
return s.step
}
@@ -761,7 +761,7 @@ func (s *StepRequestValidation) Type() StepType {
return StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
}
func (s *StepRequestValidation) ToStruct() *TStep {
func (s *StepRequestValidation) Struct() *TStep {
return s.step
}

View File

@@ -39,7 +39,7 @@ func (s *StepTestCaseWithOptionalArgs) Type() StepType {
return stepTypeTestCase
}
func (s *StepTestCaseWithOptionalArgs) ToStruct() *TStep {
func (s *StepTestCaseWithOptionalArgs) Struct() *TStep {
return s.step
}

View File

@@ -24,7 +24,7 @@ func (s *StepThinkTime) Type() StepType {
return stepTypeThinkTime
}
func (s *StepThinkTime) ToStruct() *TStep {
func (s *StepThinkTime) Struct() *TStep {
return s.step
}

View File

@@ -35,7 +35,7 @@ func (s *StepTransaction) Type() StepType {
return stepTypeTransaction
}
func (s *StepTransaction) ToStruct() *TStep {
func (s *StepTransaction) Struct() *TStep {
return s.step
}

View File

@@ -39,7 +39,7 @@ func (tc *TestCase) ToTCase() *TCase {
Config: tc.Config,
}
for _, step := range tc.TestSteps {
tCase.TestSteps = append(tCase.TestSteps, step.ToStruct())
tCase.TestSteps = append(tCase.TestSteps, step.Struct())
}
return tCase
}