Blog Engineering How to continuously test web apps and APIs with Hurl and GitLab CI/CD
2022-12-14
2 min read

How to continuously test web apps and APIs with Hurl and GitLab CI/CD

Hurl as a CLI tool can be integrated into the DevSecOps platform to continuously verify, test, and monitor targets. It also offers integrated unit test reports in GitLab CI/CD.

post-cover-image.jpg

Testing websites, web applications, or generally everything reachable with the HTTP protocol, can be a challenging exercise. Thanks to tools like curl and jq, DevOps workflows have become more productive and even simple monitoring tasks can be automated with CI/CD pipeline schedules. Sometimes, use cases require specialized tooling with custom HTTP headers, parsing expected responses, and building end-to-end test pipelines. Stressful incidents also need good and fast tools that help analyze the root cause and quickly mitigate and fix problems.

Hurl is an open-source project developed and maintained by Orange, and uses libcurl from curl to provide HTTP test capabilities. It aims to tackle complex HTTP test challenges by providing a simple plain text configuration to describe HTTP requests. It can chain requests, capture values, and evaluate queries on headers and body responses. So far, so good: Hurl does not only support fetching data, it can be used to test HTTP sessions and XML (SOAP) and JSON (REST) APIs.

Getting Started

Hurl comes in various package formats to install. On macOS, a Homebrew package is available.

$ brew install hurl

First steps with Hurl

Hurl proposes to start with the configuration file format first, which is a great way to learn the syntax step by step. The following example creates a new gitlab-contribute.hurl configuration file that will do two things: execute a GET HTTP request on https://about.gitlab.com/community/contribute/ and check whether its HTTP response contains the HTTP protocol 2 and status code 200 (OK).

$ vim gitlab-contribute.hurl

GET https://about.gitlab.com/community/contribute/

HTTP/2 200
$ hurl --test gitlab-contribute.hurl
gitlab-contribute.hurl: Running [1/1]
gitlab-contribute.hurl: Success (1 request(s) in 413 ms)

We want to hear from you

Enjoyed reading this blog post or have questions or feedback? Share your thoughts by creating a new topic in the GitLab community forum. Share your feedback

Ready to get started?

See what your team could do with a unified DevSecOps Platform.

Get free trial

New to GitLab and not sure where to start?

Get started guide

Learn about what GitLab can do for your team

Talk to an expert