SuperAPI AI 工具集

test-runner

测试与质量

查看项目

更新于 10-16 00:03

技能介绍

用途:运行项目测试套件,并返回结构化的通过/失败结果。支持按目录、文件路径或测试名称模式进行限定范围的运行。

主要能力:自动从项目文件识别测试框架,包括 spec/ 与 _spec.rb 与 .rspec 对应 RSpec,test/ 与 _test.rb 对应 Minitest,jest.config.js 或 *.test.js 对应 Jest/Vitest,go.mod 与 _test.go 对应 Go test,pytest.ini 或 conftest.py 对应 pytest。识别后运行测试(提供 scope 则限定范围,否则运行完整套件),并解析输出中的通过/失败数量与失败详情。

使用方式:输入可选参数 scope,为目录、文件路径或测试名称模式。各框架命令示例:RSpec 全量 bundle exec rspec,单文件 bundle exec rspec path/to/spec.rb,单个 bundle exec rspec path:LINE;Minitest 全量 bundle exec rake test,单文件 ruby -Itest path/to/test.rb,单个 ruby -Itest path -n test_name;Jest 全量 npx jest,单文件 npx jest path/to/test.js,单个 npx jest path -t "name";pytest 全量 pytest,单文件 pytest path/to/test.py,单个 pytest path::test_name;Go 全量 go test ./...,单目录 go test ./path/,单个 go test ./path/ -run TestName。

输出:status 为 PASS 或 FAIL,total、passed、failed 为整数,失败时包含 failures 列表,每项含 file、line、name、message。

限制与错误处理:测试框架不明确时询问用户;测试失败时返回 FAIL 及失败详情;命令出错时返回 FAIL 并附带 stderr。其他收费、平台等信息暂未提供。