一键导入
testfully-script
A skill for writing JavaScript code that uses Testfully's built-in scripting capabilities to automate tasks and processes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
A skill for writing JavaScript code that uses Testfully's built-in scripting capabilities to automate tasks and processes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
A skill for authoring TFML (Testfully Markup Language) files with the correct supported file kinds, schemas, field names, and shared object structures.
Use when helping Testfully customers run API tests from the command line, configure Testfully CLI run options, generate reports, or check the installed CLI version.
| name | testfully-script |
| description | A skill for writing JavaScript code that uses Testfully's built-in scripting capabilities to automate tasks and processes. |
| license | MIT |
| metadata | {"author":"testfully","version":"1.0.0"} |
A comprehensive skill for writing JavaScript code that uses Testfully's built-in scripting capabilities to automate tasks and processes as part of Before Request and After Response script hooks in Testfully.
Use and reference this skill and guidelines when:
Below is a quick reference to the key APIs and capabilities of Testfully's scripting environment. Use this as the starting point and deep dive into individual API documentation using the "Learn more" links for detailed explanations and examples.
Use these APIs to record diagnostic information from Before Request and After Response scripts in the request Logs tab.
| API | Description |
|---|---|
console.log(...args) | Write informational logs to the Logs tab or CLI terminal. |
console.info(...args) | Write informational logs to the Logs tab or CLI terminal. |
console.warn(...args) | Write warning logs to the Logs tab or CLI terminal. |
console.error(...args) | Write error logs to the Logs tab or CLI terminal. |
Learn more: references/console.md.
Use these APIs to send bespoke HTTP requests from scripts without changing the current request.
| API | Description |
|---|---|
$.sendRequest(request) | Send a URL or request object and return a response. |
pm.sendRequest(request) | Postman-compatible alias for $.sendRequest(). |
sendRequest(request) | Legacy global alias for $.sendRequest(). |
Learn more: references/send-request.md.
Use these APIs to inspect the outgoing request and update request headers from scripts.
| API | Description |
|---|---|
$.request | Access the current request snapshot. |
pm.request | Postman-compatible alias for $.request. |
$.request.method | Read the outgoing request HTTP method. |
$.request.url | Read the outgoing request URL. |
$.request.type | Read the outgoing request body type. |
$.request.headers | Read the outgoing request headers. |
$.request.headers.add({ key, value }) | Append a request header. |
$.request.headers.upsert({ key, value }) | Add or update a request header. |
$.request.headers.remove(key) | Remove a request header by name. |
$.request.params | Read outgoing request query parameters. |
$.request.body | Read the outgoing request body fields. |
$.request.skip() | Skip the current request from Before Request. |
pm.execution.skipRequest() | Postman-compatible alias for $.request.skip(). |
Learn more: references/request.md.
Use these APIs to inspect the response returned by the current request from After Response scripts.
| API | Description |
|---|---|
$.response | Access the current response snapshot. |
pm.response | Postman-compatible alias for $.response. |
$.response.code | Read the HTTP status code. |
$.response.status | Read the HTTP status text. |
$.response.headers | Read response headers. |
$.response.body | Read the response body as a string. |
$.response.cookies | Read response cookies. |
$.response.text() | Return the response body as a string. |
$.response.json() | Parse and return the response body as JSON. |
$.response.responseTime | Read response duration in milliseconds. |
$.response.responseSize | Read response size. |
Learn more: references/response.md.
Use these APIs to record validations and write Chai-style assertions in After Response scripts.
| API | Description |
|---|---|
$.test(name, callback) | Define a named validation. |
$.expect(value) | Start a Chai-style assertion chain. |
pm.test(name, callback) | Postman-compatible alias for $.test(). |
pm.expect(value) | Postman-compatible alias for $.expect(). |
tests[name] = assertion | Legacy Postman-compatible test object. |
responseBody | Legacy Postman-compatible response body global. |
responseHeaders | Legacy Postman-compatible response headers global. |
responseCode | Legacy Postman-compatible response code global. |
responseTime | Legacy Postman-compatible response time global. |
postman.getResponseHeader(name) | Legacy Postman-compatible response header helper. |
Learn more:
references/testing-assertions.md.
Use this Postman-compatible object to inspect basic script execution metadata.
| API | Description |
|---|---|
pm.info | Access script execution metadata. |
pm.info.eventName | Read the current script phase. |
pm.info.requestName | Read the current request name. |
pm.info.requestId | Read the current request id. |
pm.info.iteration | Read the current iteration number. |
pm.info.iterationCount | Read the total iteration count. |
Learn more: references/pm-info.md.
Use these APIs to read and update the current Collection Runner iteration data from scripts.
| API | Description |
|---|---|
$.iterationData.get(key) | Get a value from the current iteration data. |
$.iterationData.has(key) | Check whether a key exists. |
$.iterationData.set(key, value) | Set a value in the current iteration data. |
$.iterationData.unset(key) | Remove a value from the current iteration data. |
$.iterationData.toObject() | Return the current iteration data as an object. |
$.iterationData.toJSON() | Return the current iteration data as JSON. |
pm.iterationData.* | Postman-compatible aliases for $.iterationData.*. |
Learn more: references/iteration-data.md.
Use this API to read request and response data from completed steps in a multi-step request.
| API | Description |
|---|---|
$.steps(stepIndex) | Return completed step data by zero-based index. |
Learn more: references/steps.md.
Use these APIs to retrieve cookies returned by the current response from After Response scripts.
| API | Description |
|---|---|
$.cookies.get(name) | Get a response cookie value by name. |
$.cookies.has(name) | Check whether a response cookie exists. |
$.cookies.toObject() | Return response cookies as an object. |
pm.cookies.get(name) | Postman-compatible alias for $.cookies.get(). |
pm.cookies.has(name) | Postman-compatible alias for $.cookies.has(). |
pm.cookies.toObject() | Postman-compatible alias for $.cookies.toObject(). |
Learn more: references/response-cookies.md.
Use these APIs to read and update workspace-level global variables from scripts.
| API | Description |
|---|---|
$.globals.get(name) | Get a global variable value. |
$.globals.has(name) | Check whether a global variable exists. |
$.globals.set(name, value) | Set a global variable value. |
$.globals.unset(name) | Remove a global variable. |
$.globals.clear() | Remove all global variables. |
$.globals.toObject() | Return global variables as an object. |
pm.globals.* | Postman-compatible aliases for $.globals.*. |
postman.*GlobalVariable(...) | Legacy Postman-compatible global variable helpers. |
globals | Legacy global object containing global variables. |
Learn more: references/globals.md.
Use globalThis to expose JavaScript constants and helper functions to scripts
within the same collection or folder tree.
| API | Description |
|---|---|
globalThis.NAME = value | Define a globally scoped script value. |
globalThis.helper = function (...) { ... } | Define a globally scoped helper function. |
NAME | Read a globally scoped script value. |
Learn more: references/global-this.md.
Use these APIs to read and update variables from the active environment.
| API | Description |
|---|---|
$.environment.get(name) | Get an environment variable value. |
$.environment.has(name) | Check whether an environment variable exists. |
$.environment.set(name, value) | Set an environment variable value. |
$.environment.unset(name) | Remove an environment variable. |
$.environment.clear() | Remove all environment variables. |
$.environment.toObject() | Return environment variables as an object. |
pm.environment.* | Postman-compatible aliases for $.environment.*. |
postman.*EnvironmentVariable(...) | Legacy Postman-compatible environment helpers. |
Learn more: references/environment.md.
Use these APIs to read and update variables from the parent folder or collection.
| API | Description |
|---|---|
$.parentFolder.variables.* | Work with variables on the request's parent folder. |
$.rootFolder.variables.* | Work with collection variables. |
pm.collectionVariables.* | Postman-compatible aliases for collection variables. |
Learn more:
references/folder-collection-variables.md.
Use standard ES module imports to load public npm packages that work in a browser-style JavaScript sandbox.
| API | Description |
|---|---|
import value from "package-name" | Import a package default export. |
import { value } from "package-name" | Import named exports. |
import value from "package-name@version" | Import a specific package version. |
Learn more: references/npm-packages.md.
Use these APIs to delay script execution or schedule callbacks inside the Testfully sandbox.
| API | Description |
|---|---|
$.sleep(ms) | Pause script execution for positive milliseconds. |
setTimeout(callback, ms) | Run a callback once after a delay. |
clearTimeout(timeoutId) | Cancel a pending timeout. |
setInterval(callback, ms) | Run a callback repeatedly at an interval. |
clearInterval(intervalId) | Cancel a running interval. |
Learn more: references/sleep.md,
references/set-timeout.md, and
references/set-interval.md.
Use these APIs to choose which request runs next while a collection is running serially in Collection Runner.
| API | Description |
|---|---|
$.setNextRequest(requestIdOrTitle) | Set the next request by id or title. |
pm.setNextRequest(requestIdOrTitle) | Postman-compatible alias for $.setNextRequest(). |
postman.setNextRequest(requestIdOrTitle) | Legacy Postman-compatible alias for $.setNextRequest(). |
Learn more: references/set-next-request.md.
Use the "Quick Reference" section above to understand the APIs and capabilities of Testfully's scripting environment. Read individual API documentation for detailed explanations, examples, and best practices for using each API effectively in your scripts.