Announcing Hurl 4.1.0
The Hurl team is happy to announce Hurl 4.1.0 !
Hurl is a command line tool powered by curl, that runs HTTP requests defined in a simple plain text format:
GET https://example.org/api/tests/4567
HTTP 200
[Asserts]
header "x-foo" contains "bar"
certificate "Expire-Date" daysAfterNow > 15
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
What’s New in This Release
- TAP Report
- Add Delay Between Requests
--connect-to
and--resolve
per Request Option- AWS Signature Version 4
- ARM 64 bits Docker Image
TAP Report
We’ve added a new test report: TAP, the Test Anything Protocol. TAP is a simple text-based interface between testing modules in a test harness. With HTML report and JUnit report, Hurl supports now TAP report.
Let’s say we run some tests. We can use --report-tap REPORT-FILE
option to set the report TAP file. If the report file
exists, results will be appended to it.
$ hurl --test --report-tap report.txt *.hurl
add-favorite.hurl: Running [1/6]
add-favorite.hurl: Success (7 request(s) in 5516 ms)
basic.hurl: Running [2/6]
basic.hurl: Success (7 request(s) in 1537 ms)
csrf.hurl: Running [3/6]
error: Assert status code
--> csrf.hurl:3:6
|
3 | HTTP 301
| ^^^ actual value is <200>
|
csrf.hurl: Failure (2 request(s) in 5527 ms)
login.hurl: Running [4/6]
login.hurl: Success (3 request(s) in 3091 ms)
perf.hurl: Running [5/6]
perf.hurl: Success (4 request(s) in 1317 ms)
security.hurl: Running [6/6]
security.hurl: Success (5 request(s) in 2278 ms)
write tap report report.txt
--------------------------------------------------------------------------------
Executed files: 6
Succeeded files: 5 (83.3%)
Failed files: 1 (16.7%)
Duration: 19304 ms
Then, we can see what our TAP report looks like:
$ cat report.txt
1..6
ok 1 - add-favorite.hurl
ok 2 - basic.hurl
not ok 3 - csrf.hurl
ok 4 - login.hurl
ok 5 - perf.hurl
ok 6 - security.hurl
Simple and neat! TAP has wide support across many language and there are many tools that can convert TAP to other formats, so it’s a nice addition to Hurl!
Add Delay Between Requests
With the new --delay
option, you can add a delay between requests:
$ hurl --delay 2000 --test *.hurl
This command add a 2 seconds delay between each request. As with a lot of Hurl command line options, you
can specify a delay for a single request, with an [Options]
section,
without impacting other requests:
GET https://foo.com/a
HTTP 200
# This next request will be runned 5s after the
# first one
GET https://foo.com/b
[Options]
delay: 5000
HTTP 200
--connect-to and --resolve per Request Option
Speaking of [Options]
sections, --connect-to
and --resolve
can now be specified per request:
GET https://foo.com/a
[Options]
connect-to: foo.com:80:localhost:8000
HTTP 200
# --resolve option allow to us custom address for a specific host and port pair.
GET http://foo.com:8000/resolve
[Options]
resolve: foo.com:8000:127.0.0.1
HTTP 200
As of Hurl 4.1.0, the [Options]
section supports:
GET https://example.org
# An options section, each option is optional and applied only to this request...
[Options]
aws-sigv4: aws:amz:sts # generate AWS SigV4 Authorization header
cacert: /etc/cert.pem # a custom certificate file
compressed: true # request a compressed response
insecure: true # allows insecure SSL connections and transfers
location: true # follow redirection for this request
max-redirs: 10 # maximum number of redirections
path-as-is: true # tell curl to not handle sequences of /../ or /./ in the given URL path
variable: country=Italy # define variable country
variable: planet=Earth # define variable planet
verbose: true # allow verbose output
very-verbose: true # allow more verbose output
If you need an Hurl command line option (which make sense for a single request) to be on this list, don’t hesitate to fill an issue!
AWS Signature Version 4
Every interaction with Amazon S3 is either authenticated or anonymous. Authenticating to AWS
is done through AWS Signature Version 4. With --aws-sigv4
,
you can use AWS Signature Version 4 to authenticate your requests
$ hurl --user someAccessKeyId:someSecretKey \
--aws-sigv4 aws:amz:eu-central-1:foo \
file.hurl
And of course, --aws-sigv4
can be specified for a single request:
GET https://foo.execute-api.us-east-1.amazonas.com/dev/bafe12
[Options]
aws-sigv4: aws:amz:eu-central-1:foo
HTTP 200
ARM 64 bits Docker Image
Hurl can be installed as a native binary on a large number of platforms. We also provide a Docker image. Since 4.1.0, Hurl Docker’s image is a multi-arch build: along x86 architectures, the image supports now ARM 64 bits targets such as Raspberry Pis, AWS A1 instances or even ARM’s Apple computers.
$ docker run -v /tmp/:/tmp/ ghcr.io/orange-opensource/hurl:4.1.0 --test example.hurl
example.hurl: Running [1/1]
example.hurl: Success (1 request(s) in 190 ms)
--------------------------------------------------------------------------------
Executed files: 1
Succeeded files: 1 (100.0%)
Failed files: 0 (0.0%)
Duration: 193 ms
Others
Changes that require a particular attention:
- we have renamed
--fail-at-end
option to--continue-on-error
as the latter is more understandable - we have fixed
--path-as-is
option name (instead of--path_as_is
)
There are other improvements and bug fixes, you can check a complete list in our release note. If you like Hurl, don’t hesitate to give us a star on GitHub or share it on Twitter / X!
We’ll be happy to hear from you, either for enhancement requests or for sharing your success story using Hurl!