I hacked together something similar to REST assured in mocha using Joi . It was designed to define validation schemas for input (and was originally part of the Hapi framework), but it worked fine for validating json rest responses. I would share my code, but it's closed source and belongs to my employer. Answer from el_twitto on reddit.com
🌐
Reddit
reddit.com › r/learnjavascript › is there any rest assured equivalent in tool in js?
r/learnjavascript on Reddit: Is there any rest assured equivalent in tool in js?
November 29, 2021 -

I have gotten a task for api automation, where I am asked to use Rest assured java or anything similar in js. I know about mocha framework but the task assessment will be based on how well I understand SOLID principles. With mocha I am not sure if its possible to do that since its bunch of describe an it blocks. Is there any other testing framework which uses classes or have the similar structure to rest assured. TIA.

🌐
Skypack
skypack.dev › view › rest-assured-ts
npm:rest-assured-ts | Skypack
January 13, 2022 - Test framework for automating rest api & JS & typescript!
🌐
Rest-assured
rest-assured.io
REST Assured
You can easily use REST Assured to validate interesting things from the response: @Test public void lotto_resource_returns_200_with_expected_id_and_winners() { when(). get("/lotto/{id}", 5). then(). statusCode(200).
🌐
npm
npmjs.com › package › @krisinc › node-rest-assured
@krisinc/node-rest-assured - npm
November 29, 2020 - const { prettyPrintJSON } = require("@krisinc/node-rest-assured"); (async () => { const inputbody = `{"username: "firstname", "lastname" : "lst" }`; const headerOptions: string = JSON.stringify({"Authorization": authToken}); const response = makeHttpRequest(url, JSON.parse(headerOptions), "POST", inputbody); console.log(${jsonValidationUtils.prettyPrintJSON(response.body)}); //=> '<!doctype html> ...' })();
      » npm install @krisinc/node-rest-assured
    
Published   Nov 29, 2020
Version   0.2.1
Author   KrisD
🌐
Medium
medium.com › @theautobot › rest-api-and-rest-assured-tutorial-understanding-and-implementing-restful-web-services-33fd5659a09a
REST API and Rest Assured Tutorial: Understanding and Implementing RESTful Web Services | by theAutoBot | Medium
July 29, 2023 - REST APIs use standard HTTP status codes, such as 200 OK, 201 Created, 404 Not Found, and others, to indicate the status of a request. ... Rest Assured is a Java-based library for testing REST APIs.
🌐
npm
npmjs.com › package › rest-assured
rest-assured - npm
November 30, 2015 - HTTP stubbing library, to develop front-ends test-first.. Latest version: 0.1.0, last published: 10 years ago. Start using rest-assured in your project by running `npm i rest-assured`. There are no other projects in the npm registry using rest-assured.
      » npm install rest-assured
    
Published   Nov 30, 2015
Version   0.1.0
Author   Willem van den Ende
🌐
Reddit
reddit.com › r/qualityassurance › automated testing rest api with javascript
r/QualityAssurance on Reddit: Automated testing REST API with javascript
September 12, 2020 -

I'd like to create a test suite for REST API I am developing and I'd like to do it in javascript. In addition, I'd like to run these tests as part of CI/CD.

What are the best JS frameworks for this purpose? Can I use Node and Jest or something like that?

I am completely new to this topic and when I did some googling I learned that many people recommend Postman but for some reason I don't like that app. Yes it's good for manual testing while I'm developing my API, but somehow I feel this tool is bloated, it has like million options that distract me. I liked it more when it was just a simple tool and freeware project several years ago, now it's multi-billion company driven by the profit.

Anyway, I don't want to couple my tests and code to the Postman and I'd just like to use some standard testing stack, like node/jest or something like that. Note: I am developer familiar with JS and .NET.

Any suggestions?

🌐
Google Groups
groups.google.com › g › rest-assured › c › 7V_rehOR0JQ
enable the javascript
Rest assured knows nothing about evaluating javascript and cannot execute it.
Find elsewhere
🌐
C# Corner
c-sharpcorner.com › blogs › api-testing-java-and-javscript-libraries
API Testing - Java and JavaScript Libraries
December 4, 2023 - RestAssured.baseURI="https://reqres.in/"; String requestBody = "{\n" + " \"email\": \"[email protected]\",\n" + " \"password\": \"cityslicka\"\n" + "}"; Response res=given(). contentType(ContentType.JSON). body(requestBody). when(). post("api/login"). then().log().all() .extract().
🌐
GeeksforGeeks
geeksforgeeks.org › software testing › api-testing-with-rest-assured
Api Testing With REST Assured - GeeksforGeeks
January 20, 2026 - JavaScript · Data Science · Machine Learning · Courses · Linux · DevOps · Last Updated : 20 Jan, 2026 · EST Assured is a Java library for testing RESTful web services. It provides a simple DSL (Domain Specific Language) that makes writing ...
🌐
Dareid
dareid.github.io › chakram
Chakram - REST API test framework
describe("HTTP assertions", function () { it("should make HTTP assertions easy", function () { var response = chakram.get("http://httpbin.org/get?test=chakram"); expect(response).to.have.status(200); expect(response).to.have.header("content-type", "application/json"); expect(response).not.to.be.encoded.with.gzip; expect(response).to.comprise.of.json({ args: { test: "chakram" } }); return chakram.wait(); }); }); API testing is naturally asynchronous, which can make tests complex and unwieldy. Chakram fully exploits javascript promises, resulting in clear asynchronous tests.
Top answer
1 of 1
3

Edit: btw, there is a .net implementation as well it seems:

https://github.com/lamchakchan/RestAssured.Net

This is what the homepage says:

Testing and validation of REST services in Java is harder than in dynamic languages such as Ruby and Groovy. REST Assured brings the simplicity of using these languages into the Java domain.

http://rest-assured.io/

But I would personally argue that with tools such as rest-assured you can test your service regardless of the implementation language. You want to think of your system as black box.

On a related note, your comment that you'd like to write unit tests against a REST endpoint is somewhat incorrect if we stick to the jargon strictly.

Some argue that in such cases the tests should be written in a way, that they are agnostic of the technology used for implementing said service. For a general description please see

https://en.wikipedia.org/wiki/Black-box_testing

The benefit of this approach is that these higher level tests can be used to test even multiple implementations of said service. Imagine you're working in a microservices environment and you realize the need to rewrite your ruby application in java, but you cannot change your API (you cannot force users to change because of your internal implementation changed, even if it's inside your company, people will not talk to you in the cafeteria).

That being said, there is something to be said for not creating a polyglot development environment as well. Who is going to write those tests? If it is the same group and the tests reside in the same place (repository), you are truly better off using the same programming platform.

Note: I am not arguing you should move this black-box away from your source code, but it may be the setup sometimes.

On the contrary, lower level tests such as unit test must be stored along with the code as they specifically test the implementation and not only functionality.

So now what? You're in .NET, so probably you're better off using a tool from the "neighborhood" otherwise you may over complicate the developer environment setup for your team.

RestSharp is mentioned quite a few times here in SO.

var client = new RestClient("http://example.com");
// client.Authenticator = new HttpBasicAuthenticator(username, password);

var request = new RestRequest("resource/{id}", Method.POST);
request.AddParameter("name", "value"); // adds to POST or URL querystring based on Method
request.AddUrlSegment("id", "123"); // replaces matching token in request.Resource

// easily add HTTP Headers
request.AddHeader("header", "value");

// add files to upload (works with compatible verbs)
request.AddFile(path);

// execute the request
IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string

// or automatically deserialize result
// return content type is sniffed but can be explicitly set via RestClient.AddHandler();
RestResponse<Person response2 = client.Execute<Person>(request);
var name = response2.Data.Name;

License is Apache 2, maybe you should have a look and combine with your own general purpose testing framework.

🌐
Medium
medium.com › @dneprokos › aqa-quick-and-easy-way-to-automate-rest-api-using-javascript-with-axios-library-c6435f8df0f2
AQA: Quick and Easy way to automate REST API using JavaScript with Axios library | by Kostiantyn Teltov | Medium
August 25, 2023 - As you can see, the Axios library allows you to build tests in JavaScript very quickly and easily. So if you are good with JS or your backend is based on JS/TS programming languages, this library is for you. A sample project can be found here: node-rest-services · Thanks a lot for reading. Press enter or click to view image in full size · Test Automation · Rest Api · Quality Assurance ·
🌐
Isha
ishatrainingsolutions.org › home › courses › api testing courses
Rest Assured API Test Automation using JAVA and TESTNG Framework, JS With POSTMAN, Karate Framework along with CI/CD using Jenkins and Docker | Isha
February 10, 2026 - K6 – API Performance Testing – Live Training (K6 Tool, JavaScript Scripting, API Load Testing, Stress Testing, Spike Testing, Performance Metrics Monitoring, Threshold Validation, CI/CD... ... AI Chatbot Testing, LLM Testing, Enterprise RAG & Playwright Automation – Live Training (AI Fundamentals, RAG Architecture, LLM Evaluation, Hallucination Testing & Playwright Chatbot Automation)... ... API Automation Testing with RestAssured & Java – End-to-End Framework Development Program-Live Training (A practical, industry-oriented program designed to master REST API automation using Java...
🌐
Testsigma
testsigma.com › blog › alternatives › rest assured vs postman – top key differences, examples
REST Assured vs Postman - Top Key Differences, Examples
May 28, 2025 - REST Assured: It is primarily designed for automated testing. It allows developers to write code to automate API tests, and it integrates well with continuous integration (CI) systems, making it a powerful choice for test automation within the ...
🌐
Frugal Testing
frugaltesting.com › blog › rest-assured-vs-postman-which-api-testing-tool-is-right-for-you
REST Assured vs. Postman: Which API Testing Tool is Right for You?
While REST Assured focuses on built-in Java methods, Postman uses JavaScript for scripting validation logic. REST Assured makes it simple to validate API responses with its fluent methods and syntax.
🌐
Quora
quora.com › Can-I-incorporate-an-API-test-framework-like-rest-assured-in-my-existing-Selenium-framework
Can I incorporate an API test framework (like rest assured) in my existing Selenium framework? - Quora
SOAPUI tool uses Groovy scripting to automate the services. 4.ReadyAPI : ReadyAPI tool is used to automate both Rest and SOAP services. ReadyAPI uses either Groovy or JavaScript as the scripting language.
🌐
GeeksforGeeks
geeksforgeeks.org › software testing › how-to-test-api-with-rest-assured
How to Test API with REST Assured? - GeeksforGeeks
JavaScript · Data Science · Machine ... : 23 Jul, 2025 · REST Assured is a Java library that provides a domain-specific language (DSL) for writing powerful, easy-to-maintain tests for RESTful APIs....
Published   July 23, 2025
🌐
GitHub
github.com › rest-assured › rest-assured › wiki › usage
Usage · rest-assured/rest-assured Wiki · GitHub
An anonymous JSON root can be verified by using $ or an empty string as path. For example let's say that this JSON document is exposed from http://localhost:8080/json then we can validate it like this with REST Assured:
Author   rest-assured
Top answer
1 of 3
13

I checked your code. The thing is that XmlPath of Restassured isn't Xpath, but uses a property access syntax. If you add a body content to your sample HTML you will see that your XPath doesn't do much. The actual name of the query language is GPath. The following example works, note also the use of CompatibilityMode.HTML, which has the right config for you need:

import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.jayway.restassured.path.xml.XmlPath;
import com.jayway.restassured.path.xml.XmlPath.CompatibilityMode;

public class HtmlDocumentTest {

    @Test
    public void titleShouldBeHelloWorld() {
        XmlPath doc = new XmlPath(
                CompatibilityMode.HTML,
                "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
                        + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"
                        + "<head><title>Hello world</title></head>"
                        + "<body>some body"
                        + "<div class=\"content\">wrapped</div>"
                        + "<div class=\"content\">wrapped2</div>"
                        + "</body></html>");

        String title = doc.getString("html.head.title");
        String content = doc.getString("html.body.div.find { it.@class == 'content' }");
        String content2 = doc.getString("**.findAll { it.@class == 'content' }[1]");

        assertEquals("Hello world", title);
        assertEquals("wrapped", content);
        assertEquals("wrapped2", content2);
    }
}
2 of 3
11

If you're using the DSL (given/when/then) then XmlPath with CompatibilityMode.HTML is used automatically if the response content-type header contains a html compatible media type (such as text/html). For example if /index.html contains the following html page:

<html>
    <title>My page</title>
    <body>Something</body>
</html>

then you can validate the title and body like this:

when().
        get("/index.html").
then().
        statusCode(200).
        body("html.title", equalTo("My page"), 
             "html.body",  equalTo("Something"));