← 返回
未分类

Easy run test

Use when user needs to run api test, performance test, load test, stress test, http test etc. 当用户需要运行接口测试、性能测试、负载测试、压力测试、HTTP测试等时使用。 触发词: 接口测试、API测试、性能测试、负载测...
用于在需要执行接口测试、API测试、性能测试、负载测试、压力测试、HTTP测试等时调用。触发词:接口测试、API测试、性能测试、负载测试、压力测试、HTTP测试。
lamb lamb 来源
未分类 clawhub v0.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 352
下载
💾 0
安装
1
版本
#latest

概述

API test

通过 basjoofan test [OPTIONS] [NAME] 来运行测试脚本。

Quick Reference

参数说明必需默认值
--------------------------
--tasks, -t并发数量1
--duration, -d测试时长(秒)或分钟(例如:60s, 1m)-
--number, -n测试次数1
--path, -p测试脚本路径当前路径
--record, -r是否记录测试结果-
--stat, -s是否输出统计信息false

命令选择决策树

用户想运行测试脚本
├─ 接口测试 → basjoofan test name 测试方法名为name的接口测试
├─ 性能测试 → basjoofan test name -t 100 -d 1m 测试方法名为name的接口测试,并发数量为100,测试时长为1分钟

使用示例

让我们开始一个简单的接口测试,测试方法名为get,这是一个GET请求。

let host = "httpbin.org";

rq get`
  GET https://{host}/get
`[status == 200]

test get {
  let response = get->;
  response.status
}

这个脚本保存为.fan为后缀名的文件,例如get.fan。

如果用户想运行测试脚本

├─ 接口测试 → basjoofan test get 测试方法名为get的接口测试

├─ 性能测试 → basjoofan test get -t 100 -d 1m -s 测试方法名为get的接口测试,并发数量为100,测试时长为1分钟,输出统计信息

这是一个POST请求

let host = "httpbin.org";

rq post`
  POST https://{host}/post
`[status == 200]

test post {
  let response = post->;
  response.status
}

这是一个POST请求,请求体为application/x-www-form-urlencoded格式。

let host = "httpbin.org";

rq post`
  POST https://{host}/post
Content-Type: application/x-www-form-urlencoded

key: value
`[status == 200]

test post {
  let response = post->;
  response.status
}

这是一个POST请求,请求体为multipart/form-data格式。

let host = "httpbin.org";

rq post`
  POST https://{host}/post
  Content-Type: multipart/form-data

  key: value
  file: @path/to/file
`[status == 200]

test post {
  let response = post->;
  response.status
}

这是一个POST请求,请求体为application/json格式。

let host = "httpbin.org";

rq post`
  POST https://{host}/post
  Content-Type: application/json

  {
    "name": "Gauss",
    "age": 6,
    "address": {
      "street": "19 Hear Sea Street",
      "city": "DaLian"
    },
    "phones": [
      "+86 13098767890",
      "+86 15876567890"
    ]
  }
`[status == 200]

test post {
  let response = post->;
  response.status
}

版本历史

共 1 个版本

  • v0.0.1 当前
    2026-05-07 04:41 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 41,435
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,516
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,609