Test fails using new keywords GET On Session , DELETE On Session

In both cases you are getting a 404 response for the line

${resp}=    GET On Session    invoice-manager    /invoices/${invoiceId}

and indeed that looks to be what you expected to get, but it appears that GET On Session is treating this as a failure (4xx and 5xx are usually failure statuses where 2xx 3xx are not) but the old Get Request did not.

There appears to be mentioned of the documentation for GET On Session

By default this keyword fails if a status code with error values is returned in the response, this behavior can be modified using the expected_status and msg parameters, read more about it in Status Should Be keyword documentation. In order to disable this implicit assert mechanism you can pass as expected_status the values any or anything .

You should probably use

${resp}=    GET On Session    invoice-manager    /invoices/${invoiceId}    expected_status=404

or

${resp}=    GET On Session    invoice-manager    /invoices/${invoiceId}    expected_status=any

I would prefer to use expected_status=404 because it will let you eliminate the line

Should Be Equal As Strings ${resp.status_code} 404

As GET On Session is already doing that test for you.

Hope this helps,

Dave.

1 Like