Giter Club home page Giter Club logo

restclient-test.el's Introduction

restclient-test.el

restclient-test.el helps you turn restclient.el documents into interactive test suites.

Its functionality is captured by the following animation:

./example.gif

Usage

A 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 supported.

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

Running 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

Running M-x restclient-test-buffer runs every test found in the current buffer and displays a summary of the test results in the echo area.

Use M-x restclient-test-next-error and M-x restclient-test-previous-error to quickly jump between failed tests.

restclient-test-mode

restclient-test-mode is a minor mode that sets up key-bindings for the commands provided by restclient-test.el.

To make restclient-test-mode activate automatically when restclient-mode is activated, add the following to your initialization file:

(add-hook 'restclient-mode-hook #'restclient-test-mode)

The following table summarizes the key-bindings set up by restclient-test-mode.

Key bindingCommand
C-c C-brestclient-test-buffer
C-c C-trestclient-test-current
M-g M-n, M-g nrestclient-test-next-error
M-g M-p, M-g prestclient-test-previous-error

restclient-test.el's People

Contributors

simenheg avatar

Watchers

James Cloos avatar Chase Leinart avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.