@mauikut/hh200
v0.0.1
Published
Statically-checked DSL for testing HTTP servers
Readme
hh200 lang
Contributing
The project is in ideation phase (Update late 2025: slowly transitioning to a hazily more committal phase; expect target release date sooner rather than later!).
DRAFT.md is where I stash my thoughts. hh200/ works if you want to play with what I got so far.
stack install
bats php-dev-server integration.test# stack.yaml
snapshot:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/26.yamlFeatures
The following defining features sum up hh200 in trade-off terms.
1. Fail fast (compromising test percentage)
Well-functioning system-under-test is the only thing that should matter; we're dodging the need for skipping cases in test scripts.
2. Regex, random, time batteries (compromising binary size)
hh200 comes integrated with a full expression language BEL evaluator.
See also
LR grammar
hh200 grammar builds on hurl's, which we're going to just trust to be consistent with its parser implementation (a handwritten recursive descent parser).
Syntax decision notes
URL fragments agree with https://hurl.dev/docs/hurl-file.html#special-characters-in-strings
Development system dependencies
- bats (latest npmjs package: 1.13)
- php (latest debian stable: 8.4)
Build Dependencies
Notable aspects:
- Uses
bel-exprexpression language - Integrates with Language Server Protocol (
lsp) for IDE support - Includes both parsing (
parsec) and lexer/generator tools (alex/happy)
Development
Developing a rule in the grammar is an activity of conservatively editing src/L.x and src/P.y at the following sites.
-- src/L.x
tokens :-
...
data Token =
...
deriving (Eq, Show)-- src/P.y
%token
... { ... }
rule : ...stack purge # rm -rf .stack-work
stack run
ghciwatch --command "stack repl" --watch . --error-file errors.err --clear # fast feedback loop!
stack exec hh200 -- --version +RTS -l -RTS # generates .eventlogModelling parallel test users
Haskell distincts parallelism (executing computations simultaneously to improve performance) from concurrency (managing multiple independent computations that may interact, such as through I/O or shared resources).
hh200 doesn't try to speak in the same granularity as haskell or any parallelism-supporting languages. We could reexport our host language's semantics with our syntax; this option is always option for future implementations of hh200. But for now when we say "HTTP server test with parallel users", we are thinking about a specific semantics for the following example program:
#! ["user1", "user2"] row
"download image.jpg"
GET https://fastly.picsum.photos/id/19/200/200.jpg?hmac=U8dBrPCcPP89QG1EanVOKG3qBsZwAvtCLUrfeXdE0FI
HTTP [200 201] ("/downloads/img-{{row}}.jpg" fresh)
