restclient-test.el helps you turn restclient.el documents into
interactive test suites.
Its functionality is captured by the following animation:
restclient.el query can be turned into a test by adding a comment
line starting with
Expect: somewhere before the query, followed by
the expected status code. Currently only status code testing is
The test passes if the expected status code is a substring of the
status code from running the query. So
Expect: HTTP/1.1 200 OK,
Expect: 200 OK,
Expect: 200, and
Expect: OK would all match an
HTTP/1.1 200 OK response.
A full example is shown below (more examples can be found in example.http).
# Expect: 200 OK GET http://httpbin.org/get
M-x restclient-test-current with point inside the query
updates the buffer with the results of the test:
# Expect: 200 OK # Response: HTTP/1.1 200 OK # Result: Passed GET http://httpbin.org/get
M-x restclient-test-buffer runs every test found in the
current buffer and displays a summary of the test results in the echo
M-x restclient-test-next-error and
restclient-test-previous-error to quickly jump between failed tests.
restclient-test-mode is a minor mode that sets up key-bindings for
the commands provided by
restclient-test-mode activate automatically when
restclient-mode is activated, add the following to your
(add-hook 'restclient-mode-hook #'restclient-test-mode)
The following table summarizes the key-bindings set up by