Backend Testing Guide
SkillMediaLets your agent write, fix, and review Go tests for an ITSM backend.
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; ahel provides instructions and does not run this skill.
Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
Then ask your AI: use the Backend Testing Guide skill
About this skill
Write, repair, and review Go tests for the ITSM backend, including services, controllers, middleware, repositories, RBAC, tenant isolation, contracts, workflows, CMDB, connectors, and AI audit behavior. Use for backend test failures, regression coverage, or test design.
What this skill tells your AI
The instructions your AI receives, as published by heidsoft/itsm in .trae/skills/backend-testing-guide/SKILL.md and read by ahel’s review.
Choose the test boundary
- Pure helper or validation: table-driven unit test beside the source file.
- Service or repository behavior: use
enttest.NewClientor the repository's existing fixture. - Controller behavior: bind realistic Gin requests and assert the standard response envelope.
- Route or DTO compatibility: add coverage under
tests/contract. - Authorization or tenant boundaries: add explicit deny and cross-tenant cases under
tests/rbacor the owning package.
Copy the nearest current test fixture; generated Ent fields and service constructors change over time.
Enterprise invariants
Always test relevant invariants:
- every tenant query is scoped and cross-tenant IDs fail closed;
- lifecycle transitions are explicit and invalid transitions fail;
- controllers return DTOs, never Ent models;
- workflow, approval, AI, connector, and bulk actions create audit evidence;
- retryable initialization/import/discovery is idempotent;
- secrets and private content do not leak into responses or logs.
For AI behavior, test deterministic fallback, low confidence, disabled provider, and audit metadata. For CMDB traversal, test cycle and depth/size limits.
Execution
cd itsm-backend
go test ./service -run 'TestName' -count=1
go test ./controller ./middleware ./repository/... -count=1
go test ./tests/contract ./tests/rbac -count=1
go test ./...
Use require for setup/preconditions and assert for independent outcome checks. Generate
unique values without relying on test order. Do not connect unit tests to a developer or
production database.
Failure triage
- Re-run the narrow test with
-count=1 -v. - Identify whether the failure is fixture drift, contract drift, or product behavior.
- Fix product behavior when the test protects a documented invariant.
- Change the test only when the contract or intended behavior changed.
- Run the owning package, then
go test ./....
Signals
- GitHub stars
- 77
- Forks
- 18
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
backend-testing-guide-heidsoft- Source
- github.com/heidsoft/itsm