mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
fix: step type
This commit is contained in:
@@ -13,6 +13,9 @@ const (
|
|||||||
stepTypeAndroid StepType = "android"
|
stepTypeAndroid StepType = "android"
|
||||||
stepTypeIOS StepType = "ios"
|
stepTypeIOS StepType = "ios"
|
||||||
stepTypeShell StepType = "shell"
|
stepTypeShell StepType = "shell"
|
||||||
|
|
||||||
|
stepTypeSuffixExtraction StepType = "_extraction"
|
||||||
|
stepTypeSuffixValidation StepType = "_validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepResult struct {
|
type StepResult struct {
|
||||||
|
|||||||
@@ -522,7 +522,10 @@ func (s *StepMobileUIValidation) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepMobileUIValidation) Type() StepType {
|
func (s *StepMobileUIValidation) Type() StepType {
|
||||||
return stepTypeIOS
|
if s.step.Android != nil {
|
||||||
|
return stepTypeAndroid + stepTypeSuffixValidation
|
||||||
|
}
|
||||||
|
return stepTypeIOS + stepTypeSuffixValidation
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepMobileUIValidation) Struct() *TStep {
|
func (s *StepMobileUIValidation) Struct() *TStep {
|
||||||
|
|||||||
+12
-11
@@ -772,7 +772,8 @@ func (s *StepRequest) IOS() *StepMobile {
|
|||||||
// Shell creates a new shell action
|
// Shell creates a new shell action
|
||||||
func (s *StepRequest) Shell(content string) *StepShell {
|
func (s *StepRequest) Shell(content string) *StepShell {
|
||||||
s.step.Shell = &Shell{
|
s.step.Shell = &Shell{
|
||||||
String: content,
|
String: content,
|
||||||
|
ExpectExitCode: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &StepShell{
|
return &StepShell{
|
||||||
@@ -915,13 +916,13 @@ func (s *StepRequestExtraction) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepRequestExtraction) Type() StepType {
|
func (s *StepRequestExtraction) Type() StepType {
|
||||||
if s.step.Request != nil {
|
var stepType StepType
|
||||||
return StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
|
|
||||||
}
|
|
||||||
if s.step.WebSocket != nil {
|
if s.step.WebSocket != nil {
|
||||||
return StepType(fmt.Sprintf("websocket-%v", s.step.WebSocket.Type))
|
stepType = StepType(fmt.Sprintf("websocket-%v", s.step.WebSocket.Type))
|
||||||
|
} else {
|
||||||
|
stepType = StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
|
||||||
}
|
}
|
||||||
return "extraction"
|
return stepType + stepTypeSuffixExtraction
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepRequestExtraction) Struct() *TStep {
|
func (s *StepRequestExtraction) Struct() *TStep {
|
||||||
@@ -951,13 +952,13 @@ func (s *StepRequestValidation) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepRequestValidation) Type() StepType {
|
func (s *StepRequestValidation) Type() StepType {
|
||||||
if s.step.Request != nil {
|
var stepType StepType
|
||||||
return StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
|
|
||||||
}
|
|
||||||
if s.step.WebSocket != nil {
|
if s.step.WebSocket != nil {
|
||||||
return StepType(fmt.Sprintf("websocket-%v", s.step.WebSocket.Type))
|
stepType = StepType(fmt.Sprintf("websocket-%v", s.step.WebSocket.Type))
|
||||||
|
} else {
|
||||||
|
stepType = StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
|
||||||
}
|
}
|
||||||
return "validation"
|
return stepType + stepTypeSuffixValidation
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepRequestValidation) Struct() *TStep {
|
func (s *StepRequestValidation) Struct() *TStep {
|
||||||
|
|||||||
+2
-11
@@ -48,20 +48,11 @@ type StepShellValidation struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepShellValidation) Name() string {
|
func (s *StepShellValidation) Name() string {
|
||||||
if s.step.Name != "" {
|
return s.step.Name
|
||||||
return s.step.Name
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%s %s", s.step.Request.Method, s.step.Request.URL)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepShellValidation) Type() StepType {
|
func (s *StepShellValidation) Type() StepType {
|
||||||
if s.step.Request != nil {
|
return stepTypeShell + stepTypeSuffixValidation
|
||||||
return StepType(fmt.Sprintf("request-%v", s.step.Request.Method))
|
|
||||||
}
|
|
||||||
if s.step.WebSocket != nil {
|
|
||||||
return StepType(fmt.Sprintf("websocket-%v", s.step.WebSocket.Type))
|
|
||||||
}
|
|
||||||
return "validation"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepShellValidation) Struct() *TStep {
|
func (s *StepShellValidation) Struct() *TStep {
|
||||||
|
|||||||
Reference in New Issue
Block a user