Applies to ReadyAPI 2.2, last modified on November 17, 2017

Test recipes are JSON requests. Text-based recipes are text files with JSON contents.

To create a text-based recipe:

  1. Open any text editor and create a new empty file in it.

  2. Write JSON contents of the recipe to specify the test steps to be executed and the assertions to be used.

    We will create a sample test recipe that will contain two test steps: a REST request and a Groove Script.

    You can find this recipe below. Copy it to your file:

    Recipe Code Comment

    {
      "testSteps": [
      {
        "type": "REST Request",
        "method": "GET",
        "URI": "http://google.com/",
        "assertions": [
        {
          "type": "Valid HTTP Status Codes",
          "validStatusCodes": [
            200,
            302
            ]
          }
        ]
      },
      {
        "type": "Groovy",
        "script": "println 'Successful test run!'"
      }
      ]
    }


    Array of test steps (comma-separated)
    The test step type (request)
    The request method
    The destination URL
    Assertions applied to the test step
    The assertion name and parameters






    Separator of array items

    The test step type (script)
    The script code






  3. Save the file as RestRequest.json to some directory on your computer.

We will run this recipe in the next step.

Notes

Prev     Next

See Also

JSON Format of Test Recipes
How to: Text-Based Recipes
Creating Your First Recipe