Agent skill
vendix-bruno-test
Patterns for Bruno API testing in Vendix. Trigger: When creating API tests, editing .bru files, or verifying endpoints.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/vendix-bruno-test
Metadata
Additional technical details for this skill
- scope
-
[ "root" ] - author
- vendix-bot
- version
- 1.1
- auto invoke
- Creating API tests (Bruno)
SKILL.md
When to Use
Use this skill when:
- Creating new API endpoints that need testing.
- Debugging existing API flows.
- Adding integration tests in Bruno.
- Structuring new Bruno collections or folders.
Critical Patterns
Pattern 1: File Structure & Naming
Organize tests hierarchically matching the API domain structure:
bruno/Vendix/<Domain>/<Resource>/<Action Name>.bru
- Domain: Broad area (e.g.,
SuperAdmin,Organization,Store). - Resource: Entity being manipulated (e.g.,
Users,Products). - Action: Human-readable name (e.g.,
Create User,Get All Products).
Pattern 2: Authentication
- Default: Use
auth: inheritfor most endpoints. - Config: The collection (
collection.bru) handles Bearer auth using{{token}}. - Login: Only login endpoints should set
auth: noneand capture the token.
Pattern 3: Standard Assertions
Every test MUST include these standard assertions in the tests block:
test("Operation successful", function () {
expect(res.status).to.equal(200); // or 201
expect(res.body.success).to.be.true;
});
test("Data structure is valid", function () {
expect(res.body).to.have.property("data");
// Check specific fields
expect(res.body.data).to.have.property("id");
});
Pattern 4: Variable Chaining
Capture created IDs to use in subsequent requests (e.g., Delete or Update).
vars:post-response {
created_user_id: res.body.data.id
}
Pattern 5: DTO Alignment (CRITICAL)
When creating tests, ALWAYS inspect the backend DTO (*.dto.ts) to ensure the request body matches exactly:
- Field names (snake_case vs camelCase).
- Required fields (vs optional).
- Data types (string, number, boolean).
- Validation rules (min/max length, regex).
Example Check:
If DTO has @IsString() @IsNotEmpty() organization_name: string;, the Bruno body MUST include "organization_name": "Value".
Code Examples
Example 1: Standard Create Request (Create User.bru)
meta {
name: Create User
type: http
seq: 1
}
post {
url: http://{{url}}/admin/users
body: json
auth: inherit
}
body:json {
{
"email": "test@example.com",
"password": "Password123!",
"name": "Test User"
}
}
vars:post-response {
user_id: res.body.data.id
}
tests {
test("Create successful", function() {
expect(res.status).to.equal(201);
expect(res.body.success).to.be.true;
});
test("No sensitive data", function() {
expect(res.body.data).to.not.have.property('password');
});
}
Example 2: Login & Token Capture (Login.bru)
script:post-response {
// Set global token for next requests
bru.setVar("token", res.body.data.access_token);
}
Commands
# Run collection from CLI (if bruno-cli is installed)
bru run bruno/Vendix
# Run specific folder
bru run bruno/Vendix/SuperAdmin/Users
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?