SuperAPI AI Directory

zentao-testcase

Testing & quality

View repository

Updated 10-15 22:37

About this skill

Testcase (v2)

CRITICAL — Before starting, you MUST first use the Read tool to read ../zentao-shared/SKILL.md, which contains authentication, environment variables, and error handling.

Test case types: ZenTao test cases have multiple types, including functional testing, performance testing, interface testing, security testing, concurrency testing, destructive testing, installation testing, etc. When querying, you can filter by type.

Status determination: Test case statuses include wait (waiting), normal (normal), blocked (blocked), bypass (skipped). Among them, normal indicates that the test case passed execution.

Severity levels: Test case severity is divided into levels 1-4, with 1 being the most severe (system crash) and 4 being the lowest.

Products and projects: Test cases can be associated with a product or a project, or both at the same time. When querying, you can specify only the product or specify both the product and the project.

Friendly output: When outputting test case details, it is recommended to also output the test case URL link so that users can click to view it directly.

Testcase Status

Status Description Description
wait Waiting Waiting for execution
normal Normal/Pass Normal/Passed
blocked Blocked Blocked
bypass Bypass/Skip Skipped

Testcase Type

Type Description Description
feature Feature Test Functional testing
performance Performance Test Performance testing
interface Interface Test Interface testing
security Security Test Security testing
concurrency Concurrency Test Concurrency testing
destructive Destructive Test Destructive testing
install Installation Test Installation testing
others Others Other

Testcase Severity Levels

Level Name Description
1 Critical System crash or core functions completely unavailable
2 Major Main functions fail
3 Normal Ordinary test case
4 Minor Minor issue/UI testing

Commands

Common Use Cases

Scenario 1: Query all test cases of a product

# 列出产品 1 下的所有测试用例
zentao-cli testcase list --product 1

# 列出产品 1 下状态为正常的测试用例
zentao-cli testcase list --product 1 --status normal

Scenario 2: Query test cases by project

# 列出产品 1 下项目 5 的所有测试用例
zentao-cli testcase list --product 1 --project 5

# 列出项目 5 的所有功能测试用例
zentao-cli testcase list --product 1 --project 5 --type feature

Scenario 3: Get test case details

# 获取测试用例详细信息
zentao-cli testcase get 123

Examples

# 列出产品 1 下的所有测试用例
zentao-cli testcase list --product 1

# 列出状态为正常的测试用例
zentao-cli testcase list --product 1 --status normal

# 获取测试用例详情
zentao-cli testcase get 123

# 创建测试用例
zentao-cli testcase create --title "登录功能测试" --product 1 --type feature

Output Fields

Field Type Description
id u64 Test case ID
title string Test case title
product u64 Product ID
project u64 Project ID (optional)
type string Test case type
status string Test case status
severity u8 Severity (1-4)
pri u8 Priority (0-5)
openedBy string Created by
version u64 Version number
precondition string Preconditions (optional)
steps string Test steps (optional)
expected string Expected results (optional)

Error Handling

Common errors

Error code Description Solution
ZEN_AUTH_FAILED Token is invalid or expired Check the ZENTAO_TOKEN configuration
ZEN_NOT_FOUND Test case does not exist Check whether the test case ID is correct
ZEN_CONFIG_INVALID Invalid configuration Verify ZENTAO_URL and ZENTAO_TOKEN
ZEN_API_ERROR ZenTao API returns an error Check the server status or try again later
ZEN_PARAM_MISSING Missing required parameters Ensure the product ID is provided

Error handling example

# 遇到 auth 错误时检查认证状态
zentao-cli auth status

# 验证配置
echo $ZENTAO_URL
echo $ZENTAO_TOKEN

Gotchas

  1. product parameter: In most cases --product is required. If product is not specified, the API may not return correct results.

  2. Relationship between project and product: Test cases can exist independently of a project (associated only with product), or be associated with both project and product. When querying, --project is optional.

  3. status values: Note the distinction between testcase status (wait/normal/blocked/bypass) and bug status (active/resolved/closed).

  4. version field: ZenTao test cases have a version concept; each modification increments the case version. When retrieving details, you can see which version of the case it is.

  5. Execution result command name: When executing test case results, use zentao-cli testcase result <id> --result pass, not the old execute subcommand.