victorzhuk/skills

z-qa-api

API acceptance through a running service, with focused Go handler and dependency tests for residual risks.

查看源码

使用方法

  1. 复制安装命令,在自己的智能体环境安装前先检查源码包。
  2. 从原始文档核对所需工具、凭据和支持的宿主。
  3. 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/victorzhuk/skills --skill z-qa-api

开始前需了解

  • 安装不包含模型订阅、API 额度或访问文件的权限。
  • 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

API testing

Discover the service's test runner and existing contract-test style. Use [[z-bdd]] for acceptance through the running service's public protocol. Exercise real application wiring and required dependencies. A health response alone does not prove a business journey. Add handler or dependency integration tests only for named residual risks per [[z-testing-strategy]]. Preserve existing tests.

Handler contracts

Use net/http/httptest with the repository's assertion library. Verify status, relevant headers, response shape, and caller-visible error behavior.

Cover authentication and resource authorization separately. A 200 response alone does not establish correct data or permissions.

Use httptest.NewServer when the network/client interaction is part of the contract. A recorder proves handler behavior without a network hop.

Integration setup

Inspect existing fixtures, build tags, and wrappers before adding testcontainers, compose, or another mechanism. Match the database version and migration path used by the project.

If the project uses short-mode guards, put one in each integration entry point before accessing its fixture:

go
func TestIntegrationStore(t *testing.T) {
    if testing.Short() {
        t.Skip("requires database")
    }

    // Create the existing fixture and exercise its public contract here.
}

TestIntegration naming alone does not skip tests. A TestMain branch that calls m.Run() still executes selected tests. If short mode omits shared setup, all dependent tests must skip before using it.

  • Bound dependency startup and connection attempts.
  • Check container startup, connection-string, migration, pool-creation, and readiness errors.
  • Register cleanup immediately after each successful allocation. Close clients before terminating containers.
  • Isolate records or transactions across tests. Do not share mutable test state accidentally.
  • Keep Ryuk enabled by default. Disable it only for a documented CI limitation with an alternative cleanup mechanism.
  • Confirm both short mode without external services and the actual integration target.

Live smoke checks

Use the project's established HTTP client. Require a verified target; use test credentials and controlled fixtures.

For a service whose documented healthy response is HTTP 200 with {"status":"ok"}, this shell example checks both transport and body:

bash
set -o pipefail
response=$(curl --fail --silent --show-error --connect-timeout 5 --max-time 15 \
  --write-out '\n%{http_code}' "$HEALTH_URL") || exit 1
code=${response##*$'\n'}
body=${response%$'\n'*}
[ "$code" = 200 ] || exit 1
printf '%s' "$body" | jq -e '.status == "ok"' >/dev/null

Set HEALTH_URL from the verified target. This Bash/Zsh example requires exactly HTTP 200; --fail alone accepts other successful responses. Match the actual service contract. Do not use substring matching: unhealthy contains healthy.

A declarative tool such as Hurl is appropriate when already adopted. Do not add it merely to replace working repository tests.

Do not

  • Treat a received HTTP error response as request success.
  • Ignore errors during fixture setup.
  • Disable cleanup globally to hide a container startup failure.
  • Copy real tokens, credentials, or sensitive responses into committed fixtures.
  • Assume all Go services provision dependencies in the same way.

Verify

Run the repository's bounded handler and integration targets. Confirm a failing status, invalid body, unauthorized request, and unavailable dependency fail their intended checks. Report scope and unavailable external checks.

TestMain, Testcontainers cleanup.

See [[z-go-testing]], [[z-testing-strategy]], [[z-qa-debugger]], [[z-qa-browser]], [[z-qa-performance]].

来自同一仓库

更多 Skills

全部 Skills
victorzhuk
社区

z-accessibility

Audit and improve web accessibility following WCAG 2.2 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".

安装量
1
GitHub Stars
0
最近更新
10月22日
victorzhuk
社区

z-algo-core

DS/algorithm selection judgment for production code, not competitive tricks — hash map for membership/dedup, slice+sort beats a tree until proven, heap for top-k, two-pointer/sliding-window for scans, BFS/DFS/topo-sort for dependency shapes. Triggers on Big-O, hash map vs tree. Does not cover profiling/tuning; see [[z-go-performance]].

安装量
1
GitHub Stars
0
最近更新
10月22日
victorzhuk
社区

z-bdd

BDD acceptance contracts for humans and agents across UI, API, and CLI products. Use for Gherkin, Given-When-Then, E2E acceptance, or scenario evidence. Define repeatable scenarios with explicit assertions and required outcomes. Test selection belongs to [[z-testing-strategy]]. Go harness wiring belongs to [[z-go-bdd]].

安装量
1
GitHub Stars
0
最近更新
10月22日
victorzhuk
社区

z-codegraph

Use an existing CodeGraph integration for call graphs, impact analysis, affected tests, or route discovery. Discover installed tools and index freshness; follow host LSP precedence and verify current source. Do not initialize indexes without user authorization.

安装量
1
GitHub Stars
0
最近更新
10月22日