Glubean SDK Overview
The @glubean/sdk provides the core primitives for writing API tests that can run locally via the CLI and seamlessly in the cloud on the Glubean platform, without any code changes.
Design Philosophy
The SDK is built around a few core principles:
- Zero Magic Globals: Everything a test needs is passed explicitly via the
TestContext(ctx). There are no ambient global variables to guess. - Fail Fast & Loud: Missing environment variables, secrets, or failed hard assertions throw immediately, preventing silent, cascading failures deep within test logic.
- Observability First: Tests don’t just pass or fail—they produce rich traces, logs, and metrics. The SDK is deeply integrated with the Glubean dashboard to report this data automatically.
Core Concepts
The SDK is divided into several logical areas. Explore the documentation to understand the purpose, design rationale, and scenarios for each.
Test Structure & Organization
- Test API & Builder —
test(),.setup(),.step(),.teardown(),.use(),.group() - Data-Driven Tests —
test.each(),test.pick(), and data loaders (fromCsv,fromYaml) - Configuration — File-level shared setup using
configure()
The Test Context (ctx)
Every test function receives a ctx object (TestContext). This context object is your gateway to making HTTP requests, reading variables, asserting conditions, and logging.
- HTTP Client —
ctx.http - Environment & Secrets —
ctx.vars,ctx.secrets - Assertions & Validation —
ctx.expect,ctx.assert,ctx.warn,ctx.validate - Test Lifecycle & Control —
ctx.skip,ctx.fail,ctx.setTimeout,ctx.pollUntil,ctx.retryCount - Observability —
ctx.log,ctx.trace,ctx.metric,ctx.getMemoryUsage - Plugin System — Defining and registering plugins with
definePlugin()+configure() - Auth Plugin —
bearer,basicAuth,apiKey,oauth2,withLogin - GraphQL Plugin —
graphql,createGraphQLClient,gql,fromGql
Last updated on