View on GitHub

Jester

Jester - a JSON test tool

Download this project as a .zip file Download this project as a tar.gz file

Jester

Jester - a JSON test tool

Building Jester

Clone or download the source code and either:

Open the 'jester' folder in NetBeans or your favourite IDE, and build it.

Build a package from the command line with mvn package

Running Jester

Once built, either double-click Jester-0.5.jar in the targetfolder, or start from the command line with java -jar target/Jester-0.5.jar Then enter an API URI and click GET

Simple example

The GET request is made and the response parsed to a tree view representation of the JSON data. Values can be 'asserted' on

The 'assert' action writes a Java statement into the lower frame

This generates JUnit or TestNG output using REST Assured


  @Test
  public void test1() {
      //get:https://api.github.com/users/objectivetester
      given().filter(cookieFilter).when().get("https://api.github.com/users/objectivetester").then()
      //assert:name=Steve Mellor
      .body("name", equalTo("Steve Mellor"))
      .statusCode(200);
  }

Testing REST API's

Jester can GET, POST, DELETE and assert on values in responses and all of these operations generate Java statements using either Junit5 or TestNG.

POST

Create a request body by inserting keys and values into the Request Object (this may be a little unstable, with minimal error checking), or start by copying a response with 'File -> Copy Response into Request', or import some JSON data with 'File -> Import'.

Then click the 'POST' icon.

GET

Enter a URI into the text field and click 'GET'. The Response Object treeview will be updated with a graphical representation of the response. You can then add assertions, or copy it (from 'File -> Copy Response into Request') into the Request Object and use it in a POST.

DELETE

Sends a simple DELETE request.

Assert

Right-click on a value in the Response Object tree and assert on it.

In the lower frame, Java statements are generated. These should be runnable from an IDE, etc. after a little cleanup.

Cookies & Headers

Cookies and custom headers can be included in the requests by adding them to the text boxes as a comma seperated list of key=value pairs - e.g.

Authorization=Bearer abcde..., JSESSIONID=1234...

Query Parameters

Add query parameters to the request by adding them to the URI - e.g.

q=test&type=debug

Authorization

Jester works with:


API Keys - by including the key as a query string, header or cookie

Basic auth - by including the user:passwd as Base64 in a header - e.g. `Authorization=Basic dXNlcjpwYXNzd2Q=`

Bearer token - by including the token in a header - e.g. `Authorization=Bearer abcde....`

Cookie auth - cookies can be set and are extracted from responses, they may need to be cleaned up in the tests.