REST Fire

Let me introduce you to my latest pet project – REST Fire. It's basically a thin wrapper around Apache HTTP client, providing simple DSL for REST service testing. You can test your REST APIs like this:

        fire().get()
                .to("https://www.google.com/search?q=rest-fire")
                .withHeader("Accept", "text/html")
        .expectResponse()
                .havingStatusEqualTo(200)
                .havingHeader("Content-Type", hasItem(startsWith("text/html")))
                .havingBody(containsString("rest-fire"));

And that's basically all. If you know REST Assured library, you may be asking why I just do not use REST Assured and write something new instead. Apart from NIH syndrome, I have two reasons.

First of all, I do not like REST Assured syntax, where you define the request, then you validate the response and then again you send the request. REST Fire is more straightforward, just fire a requst and validate the response. The syntax is strongly inspired by Jadler, so if you want to mock backends and test your API at the same time, you do not have to switch between two different styles.

Secondly, REST fire is built on top of Apache HTTP client and lets you configure whatever you want. It's even capable to use our exotic authentication mechanism.

Usage of Apache HTTP client has its downsides too. It is hard to simulate invalid requests. Apache HTTP client tries to make sure that the requests are valid and if you need to test reactions on invalid requests, you are out of luck.

So if you want to try REST fire, visit its GitHub page for more details and let me know what you think about it.

Comments are closed.