YAML based API testing tool. 开源接口调试、测试工具。Mock Server
APACHE-2.0 License
中文 | English
一个开源的 API 测试工具。🚀
hd install atest
您也可以通过 kubernetes 安装,更多细节请参考: manifests.
用法如下:
API testing tool
Usage:
atest [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
func Print all the supported functions
help Help about any command
json Print the JSON schema of the test suites struct
run Run the test suite
sample Generate a sample test case YAML file
server Run as a server mode
service Install atest as a Linux service
Flags:
-h, --help help for atest
-v, --version version for atest
Use "atest [command] --help" for more information about a command.
API Testing 使用示例,在此示例中,您将通过 md 格式阅览生成的接口测试报告:
atest run -p sample/testsuite-gitlab.yaml --duration 1m --thread 3 --report md
API | Average | Max | Min | Count | Error |
---|---|---|---|---|---|
GET https://gitlab.com/api/v4/projects | 1.152777167s | 2.108680194s | 814.928496ms | 99 | 0 |
GET https://gitlab.com/api/v4/projects/45088772 | 840.761064ms | 1.487285371s | 492.583066ms | 10 | 0 |
consume: 1m2.153686448s |
在 Docker 中以服务器模式运行 atest
,您可以通过 8080
访问 atest
的 UI 控制台:
docker run --pull always -p 8080:8080 ghcr.io/linuxsuren/api-testing:master
在 Docker 中使用 atest-collector
:
docker run -p 1234:8080 -v /var/tmp:/var/tmp \
ghcr.io/linuxsuren/api-testing atest-collector \
--filter-path /api \
-o /var/tmp/sample.yaml
# you could find the test cases file from /var/tmp/sample
# cat /var/tmp/sample
以下字段的模板配置参考:sprig:
您可以使用 sprig 中的所有常用函数。此外,还有一些特殊函数可以在 atest
中使用:
Name | Usage |
---|---|
randomKubernetesName |
{{randomKubernetesName}} to generate Kubernetes resource name randomly, the name will have 8 chars |
sleep |
{{sleep(1)}} in the pre and post request handle |
atest
可以验证任何类型的 Kubernetes 资源。使用前请先设置 Kubernetes 相关的环境变量:
KUBERNETES_SERVER
KUBERNETES_TOKEN
另请参考 example。
欢迎使用以下联系方式,探讨有关 API Testing 的任何问题!
[email protected]
, 欢迎通过此邮件列表讨论与 API Testing 相关的任何问题。