Registry / testing / apickli

apickli

JSON →
library3.0.3jsnpmunverified

apickli is a collection of utility functions and a Gherkin-based BDD framework for REST API integration testing built on top of Cucumber.js. The latest stable version is 3.0.3, which introduced support for HTTP/2 and updated dependencies. It simplifies API testing by providing predefined step definitions for common HTTP operations, response validation, and state management. Compared to other tools like Frisby or Supertest, apickli integrates tightly with Cucumber's Gherkin syntax, enabling non-technical stakeholders to write and understand tests. It supports JSON and XML responses, query parameters, headers, and authentication. Released less frequently, with a focus on stability.

npm install apickli
INSTALL
IMPORT
SIG · APICKLI
A
apickli
testingjavascriptv3.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

apickli
import { apickli } from 'apickli';
const apickli = require('apickli');
apickli is ESM-only since v3. Default export is recommended.
defineSupportCode
import { defineSupportCode } from 'cucumber';
const defineSupportCode = require('cucumber').defineSupportCode;
This is actually from Cucumber, but commonly misattributed.
Apickli
import { Apickli } from 'apickli';
import Apickli from 'apickli';
Named export is the constructor class. Default export is the legacy function.

This shows how to set up a Cucumber step definition file using apickli to send GET requests and assert response status codes.

// features/step_definitions/api_steps.js const { apickli } = require('apickli'); const { defineSupportCode } = require('cucumber'); defineSupportCode(function({ When, Then }) { When(/^I send a GET request to "([^"]*)"$/, function(path, callback) { this.apickli = new apickli.Apickli('http://example.com'); this.apickli.get(path, callback); }); Then(/^the response status should be (\d+)$/, function(status, callback) { this.apickli.assertResponseCode(status, callback); }); });
Debug
Known issues
breakingapickli v3 dropped support for Node.js < 12 and migrated to ESM-only exports.
fix
Upgrade Node to >=12. Use import syntax instead of require.
affects: >=3.0.0
deprecatedThe default export (apickli as function) is deprecated in v3 and will be removed in v4. Use named exports.
fix
Replace default import with named imports: import { apickli, Apickli } from 'apickli';
affects: >=3.0.0
gotchaStep definitions must use 'this.apickli' to access the apickli instance. Using a local variable will cause undefined errors.
fix
Always assign apickli to 'this.apickli' inside step definition functions.
affects: >=1.0.0
gotchaapickli expects Cucumber's World class to have a 'apickli' property. Creating a custom World without this property will break steps.
fix
Ensure custom World object sets this.apickli during initialization.
affects: >=1.0.0
gotchaAssertion failures in step definitions do not throw errors; instead they call the callback with error. Neglecting to handle the callback will mask failures.
fix
Always pass the callback to apickli assertion methods or use a wrapper that throws.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: apickli is not a constructor
Importing apickli as a default function instead of named export in v3.
fix
Use import { Apickli } from 'apickli'; const apickli = new Apickli(baseURL);
Error: Cannot find module 'cucumber'
cucumber is a peer dependency and not automatically installed.
fix
Run npm install cucumber --save-dev
ReferenceError: defineSupportCode is not defined
defineSupportCode is not exported by apickli; it comes from cucumber.
fix
Import defineSupportCode from 'cucumber' rather than from 'apickli'.
TypeError: Cannot read property 'apickli' of undefined
Using this.apickli in a non-Cucumber context or missing setup.
fix
Ensure steps are only called within Cucumber scenarios and that the World has apickli initialized.
Upgrade
Version history
3.0.3latest on npm
Audit
Dependencies
cucumberrequiredapickli is a Cucumber.js framework, requiring cucumber runtime for step definitions.
Agent activity
41 hits · last 30 days
node
36
OpenAI (training)
1
Resources
apickli — npm install apickli · libregistry