Dighate
Dighate

Reputation: 91

How to get the HTTP/REST Method Type of a testStep from groovy

I am working an a bulk update utility for large sets of SoapUI Projects. The update will depend upon what type of REST method each Test Step is for example: POST,GET,PUT

Right now I only care about REST type test steps, so I am filtering them by :

    if (testStep.config.type == "restrequest") {
        log.info "REST type test step found! " 
     }

But, is there a way to know what method the testStep is using ? I specially care about POST methods.

Thanks in Advance.

Upvotes: 0

Views: 855

Answers (1)

albciff
albciff

Reputation: 18507

On the testSteps of type REST you can use getRestMethod() to get RestMethod and then getMethod() on it:

if (testStep.config.type == "restrequest") {
     log.info "REST type test step found! " 
     log.info "Method type ${ts.getRestMethod().getMethod()}"
}

Upvotes: 3

Related Questions