Skip to main content

Testing JSON APIs

This is the best place to start your automated journey. Your JSON and RESTful APIs have predictable inputs and outputs and are really easy to to begin automating.

Here is a basic example with GET:

import { Scenario, Suite } from "@qaflag/core";
import { JsonContext, JsonScenario } from "@qaflag/json";

export class UsersSuite extends Suite({
title: "Test Users Endpoints",
type: JsonScenario,
baseUrl: "",
}) {
uri: "GET /users",
async getListOfUsers(context: JsonContext) {
const users = context.find("[*]");;
users.array.length.must.equal(10);["id", "name", "username", "email"]);