burl: A simple but flexible HTTP/3 testing framework based on bash and curl #2278
-
Hurl is a great testing framework! It uses a toml-like DSL to describe test cases, which is user-friendly. However, in my opinion, it has following disadvantages:
So I had an idea, why not unify the testing framework and test cases directly through bash and curl and make it language agnostic i.e. the framework can be easily extended using python modules, ruby gems or simple 3rd party shell commands. I've created a new HTTP/3 testing framework based on bash and curl: https://github.com/kingluo/burl Synopsis: #!/usr/bin/env burl
# Optional initialization here...
# Before all test cases are executed.
# For example, render nginx.conf and start nginx.
SET NGX_CONF_HTTP <<EOF
upstream test_backend {
server $(dig +short nghttp2.org):443;
keepalive 320;
keepalive_requests 1000;
keepalive_timeout 60s;
}
EOF
SET NGX_CONF <<'EOF'
location / {
add_header Alt-Svc 'h3=":443"; ma=86400';
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host "nghttp2.org";
proxy_pass https://test_backend;
}
EOF
START_NGX
TEST 1: test case
# Send request
# REQ is a curl wrapper so you can apply any curl options to suit your needs.
# Check https://curl.se/docs/manpage.html for details.
REQ /httpbin/anything --http3 -d foo=bar -d hello=world
# Validate the response headers
# HEADER is a grep wrapper so you can apply any grep options and regular expressions to suit your needs.
HEADER -x "HTTP/3 200"
# Validate the response body, e.g. JSON body
# JQ is a jq wrapper so you can apply any jq options and jq expression to suit your needs.
JQ '.method=="POST"'
JQ '.form=={"foo":"bar","hello":"world"}'
TEST 2: another test case
# ...
# More test cases... Please check out the blog post for background and design details: http://luajit.io/posts/a-simple-http3-testing-framework-based-on-bash-and-curl/ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Nice idea and good luck with your project ! (FYI Hurl is written in Rust, not in Go) |
Beta Was this translation helpful? Give feedback.
Nice idea and good luck with your project ! (FYI Hurl is written in Rust, not in Go)