Bash 脚本自动化测试
原名:bats-testing-patterns
为命令行脚本建立退出码、输出和异常场景测试,使用隔离夹具保护真实文件。
中文 Skills 技能说明
维护安装、备份或数据脚本时,可让测试自动化工程师与开发岗位数字员工补测试。输入脚本、参数、预期输出和运行 Shell,技能按 Bats 方式安排 setup、teardown、模拟命令与错误条件,交付测试草稿和运行说明。Bats 需自行安装,Windows 需兼容环境,测试不默认具备管理员权限。先用临时目录和模拟外部服务,不删除真实资料或触发生产动作;桌面端写测试与运行需授权,测试覆盖不等于线上验收。
上游能力依据
上游原始适用说明:Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test-driven development of shell utilities.
上游 SKILL.md 主要章节(保留原文标题):
- When to Use This Skill
- Detailed patterns and worked examples
- Testing Error Conditions
- Testing with Dependencies
- Testing Shell Compatibility
- Parallel Execution
- Test Helper Pattern
- testhelper.sh
- Integration with CI/CD
- GitHub Actions Workflow
使用边界
先复现问题并固定测试范围,再生成或执行测试。测试通过只能证明已覆盖的场景,不能代替生产环境验收。
作者、翻译与许可证
- 原作者
- Seth Hobson(wshobson)与 agents contributors
- 中文翻译
- CEOFans翻译
- 许可证
- MIT
- 上游来源
- https://github.com/wshobson/agents/tree/46891e7e60da0e52baf1050b7b6391b64e84c6d9/plugins/shell-scripting/skills/bats-testing-patterns
适用范围
平台:linux、macos、windows;标签:测试与质量、Bash 脚本自动化测试、开源技能
安全提示
基础静态扫描不等于绝对安全。技能可能调用命令、浏览器、云服务或本地文件,请在最小权限环境中使用,高风险操作必须人工确认。
如发现侵权、许可证或安全问题,可在本页前台提交投诉,管理员复核后可立即下架。