Skip to content

Zerocode retry step during API test automation

authorjapps edited this page Aug 12, 2020 · 5 revisions

Introduction

Retry mechanism is particularly useful when the step fails for the first time and there is a chance to get the API response as expected in teh next invocation which could make the test pass.

This happens mostly during a async call in the earlier steps or an CDC update which could slightly delay in persisting the changes into the server in the earlier step(s).

where,
CDC = Change Data Capture

Retry Example

  • YAML
url: api/v1/customers/123
method: GET
request:
  headers:
    Content-Type: application/json
retry:
  max: 3
  delay: 1000
verify:
  status: 200
...
  • JSON
{
  "url": "api/v1/customers/123",
  "method": "GET",
  "request": {
    "headers": {
      "Content-Type": "application/json"
    }
  },
  "retry": {
    "max": 3,
    "delay": 1000
  },
  "verify": {
    "status": 200
...

In the DSL above Zerocode framework will retry invoking the API only if the server does not respond with status of 200

When the server responds with status 200, there will be no more retries/invocation

Reports

CSV or HTML report will have only one entry ie the final outcome of the step after all retries exhausted

Logs

target/logs will have all the retry logs and request/response payload

Blogs

Clone this wiki locally