MCPcopy
hub / github.com/httprunner/httprunner / MakeCompat

Method MakeCompat

hrp/testcase.go:98–125  ·  view source on GitHub ↗

MakeCompat converts TCase compatible with Golang engine style

()

Source from the content-addressed store, hash-verified

96
97// MakeCompat converts TCase compatible with Golang engine style
98func (tc *TCase) MakeCompat() (err error) {
99 defer func() {
100 if p := recover(); p != nil {
101 err = fmt.Errorf("[MakeCompat] convert compat testcase error: %v", p)
102 }
103 }()
104 for _, step := range tc.TestSteps {
105 // 1. deal with request body compatibility
106 convertCompatRequestBody(step.Request)
107
108 // 2. deal with validators compatibility
109 err = convertCompatValidator(step.Validators)
110 if err != nil {
111 return err
112 }
113
114 // 3. deal with extract expr including hyphen
115 convertExtract(step.Extract)
116
117 // 4. deal with mobile step compatibility
118 if step.Android != nil {
119 convertCompatMobileStep(step.Android)
120 } else if step.IOS != nil {
121 convertCompatMobileStep(step.IOS)
122 }
123 }
124 return nil
125}
126
127func (tc *TCase) ToTestCase(casePath string) (*TestCase, error) {
128 if tc.TestSteps == nil {

Callers 6

toTestCaseMethod · 0.95
ToTCaseMethod · 0.95
LoadCurlCaseFunction · 0.95
ToTCaseMethod · 0.95
LoadJSONCaseFunction · 0.80
LoadYAMLCaseFunction · 0.80

Calls 4

convertCompatRequestBodyFunction · 0.85
convertCompatValidatorFunction · 0.85
convertExtractFunction · 0.85
convertCompatMobileStepFunction · 0.85

Tested by

no test coverage detected