MCPcopy
hub / github.com/httprunner/httprunner / Extract

Method Extract

hrp/response.go:148–162  ·  view source on GitHub ↗
(extractors map[string]string, variablesMapping map[string]interface{})

Source from the content-addressed store, hash-verified

146}
147
148func (v *responseObject) Extract(extractors map[string]string, variablesMapping map[string]interface{}) map[string]interface{} {
149 if extractors == nil {
150 return nil
151 }
152
153 extractMapping := make(map[string]interface{})
154 for key, value := range extractors {
155 extractedValue := v.searchField(value, variablesMapping)
156 log.Info().Str("from", value).Interface("value", extractedValue).Msg("extract value")
157 log.Info().Str("variable", key).Interface("value", extractedValue).Msg("set variable")
158 extractMapping[key] = extractedValue
159 }
160
161 return extractMapping
162}
163
164func (v *responseObject) Validate(iValidators []interface{}, variablesMapping map[string]interface{}) (err error) {
165 for _, iValidator := range iValidators {

Callers 10

testcase_test.goFile · 0.45
TestWebSocketProtocolFunction · 0.45
TestCaseParseVariablesFunction · 0.45
TestRendezvousFunction · 0.45
TestCaseCallFunctionFunction · 0.45
TestCaseValidateStepFunction · 0.45

Calls 1

searchFieldMethod · 0.95

Tested by 9

TestWebSocketProtocolFunction · 0.36
TestCaseParseVariablesFunction · 0.36
TestRendezvousFunction · 0.36
TestCaseCallFunctionFunction · 0.36
TestCaseValidateStepFunction · 0.36