DEV Community

Cover image for API testing for serious developers
Gayan Hewa
Gayan Hewa

Posted on

API testing for serious developers

Ok, I didn't mean "serious" developers. I just want to make the title look fancy. This will actually work for anyone, even for those who are not in the emacs eco-system.

I personally spend quite a bit of my time building and consuming web services. A few years back I was introduced to Postman and it blew my mind. Because of the simplicity and mostly for the ability to share collections across the team. So far I still use Postman when necessary, but I find it hard to switch between my editor and the postman client, just because I can test an endpoint or call some service I am integrating so I can verify its outcome. Hands down Postman is a great tool for the team although its bloat in the right areas.

Postman yay!!!

After switching over to emacs, I was looking for a way not to move out of the editor while developing a new API or consuming one already. For most other IDE's you can opt to use a plugin or use the terminal session with httpie with some slight mods. I am not saying this is the best way to go. But it certainly proved to be the best way for me IMO.

Getting started with restclient.el

The restclient.el package can be installed easily through MELPA. The package provides some awesome documentation. And the code is quite easy to understand.

You will have a few default key-bindings, which can be easily remapped, for an instance the most commonly used ones for me is C-c C-c to run the test group under the cursor. C-c C-n to jump to the next query and C-c C-p to jump to the previous query. Another nifty trick is when I want to share a query with someone I quickly copy the curl version of it by pressing C-c C-u

Top comments (0)