MakeCompat converts TCase compatible with Golang engine style
()
| 96 | |
| 97 | // MakeCompat converts TCase compatible with Golang engine style |
| 98 | func (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 | |
| 127 | func (tc *TCase) ToTestCase(casePath string) (*TestCase, error) { |
| 128 | if tc.TestSteps == nil { |
no test coverage detected