Hurl 1.8.0, text based integration tests for REST APIs and web sites

42 points jcamiel

We're happy to announce Hurl 1.8.0.

Hurl is an Open Source command line tool that allow you to test REST APIs and HTML content with simple
plain text files. Hurl is a lightweight fast single binary, available on Windows, Linux, macOS (through various packet managers
brew, npm etc...), based on curl, and well adapted for integration tests.

A Hurl sample:

POST https://example.org/api/tests
{
    "id": "4568",
    "evaluate": true
}

HTTP/1.1 200
[Asserts]
header "X-Frame-Options" == "SAMEORIGIN"
jsonpath "$.status" == "RUNNING"    # Check the status code
jsonpath "$.tests" count == 25      # Check the number of items
jsonpath "$.id" matches /\\d{4}/     # Check the format of the id

More samples...

Hurl has been designed to be used on local dev and to be easily integrated in CI/CD (like GitHub Actions or GitLab CI/CD for instance).
Hurl is really fast, and its text format make it suitable for both devops and developers. If you're intrigued, we've written a step-by-step tutorial that shows how you can test a simple website and add integration tests with GitHub Actions.

In this new 1.8.0 version, we're supporting polling and asynchronous scenarios. Let's say we have an API to create a ressource. Once created, we want to poll this resource and wait until it reaches a certain state. We can do this with this sample file:

  • First we create a new resource with a POST request. We capture the id of the resource to be able to use it
    in the following requests
  • Then, we pull the resource with a GET request and check its state value.
# Create a new job
POST https://api.example.org/jobs

HTTP/* 201
[Captures]
job_id: jsonpath "$.id"


# Pull job status until it is completed
GET https://api.example.org/{{job_id}}
[Options]
retry: true

HTTP/* 200
[Asserts]
jsonpath "$.state" == "COMPLETED"

More information on this release:

We'll be happy to hear from you, either for enhancement requests or for sharing your success story using Hurl!