Write Tests
The SDK is the authoring surface of Glubean — a developer-owned API verification platform.
You write tests in TypeScript, commit them to git, run them locally or in CI, and optionally upload the results to Cloud. The code stays the same across environments.
Install
npm install @glubean/sdkThe mental model
Every test receives a ctx object. That context gives you:
ctx.httpfor requests (auto-traced)ctx.varsandctx.secretsfor runtime valuesctx.expect,ctx.assert, andctx.validatefor verificationctx.log,ctx.trace, andctx.metricfor observabilityctx.sessionfor shared state across files- plugins for browser automation, GraphQL, auth, and anything custom
A minimal test
import { test } from "@glubean/sdk";
export const health = test("health", async (ctx) => {
const baseUrl = ctx.vars.require("BASE_URL");
const res = await ctx.http.get(`${baseUrl}/health`);
ctx.expect(res.status).toBe(200);
});Start with these pages
- Test Shape —
test(), builder API,test.each,test.pick - Configuration —
configure()for shared setup - HTTP Requests —
ctx.httpclient - Assertions —
expect,assert,validate,warn - Data-Driven —
test.each,test.pick, data loaders - Variables & Secrets —
ctx.vars,ctx.secrets
When the suite grows
- Use the builder API for multi-step flows
- Use
configure()and plugins for shared setup - Use
session.tsfor cross-file shared state - Emit logs and metrics when a green or red result alone is not enough
Last updated on