| name | test-design |
| description | Automatically design comprehensive E2E test cases for newly implemented vibing.nvim features. Use immediately after completing feature implementation (Phase 5.4) and before running E2E tests. Generates test scenarios covering Happy paths, Error cases, Edge cases, and Integration points with priority ranking (Critical/High/Medium/Low) and ready-to-use test code templates using e2e_helper.lua. |
Test Design for vibing.nvim
Generate comprehensive E2E test scenarios after implementing new features.
Usage
Provide context when invoking:
/test-design
I implemented [feature description].
Changed files:
- [list of new/modified files]
Existing tests:
- [list of existing test files]
Example:
/test-design
I implemented a new slash command `/export` that exports chat history to Markdown.
Changed files:
- lua/vibing/application/chat/slash_commands.lua (added export_command)
- lua/vibing/utils/markdown_exporter.lua (new file)
Existing tests:
- tests/e2e/chat_basic_flow_spec.lua (basic chat operations)
Output Format
1. Test Scenario Analysis
Categorized scenarios with checkboxes:
- Happy Path โ
- Most common use cases
- Error Cases โ - Error handling (validation, network, permissions)
- Edge Cases ๐ธ - Boundary conditions, special characters, timeouts
- Integration Points ๐ - Interactions with other features
2. Priority Ranking
- Critical: Core functionality - must work for release
- High: Error handling - security, data loss prevention
- Medium: Usability - edge cases, user experience
- Low: Performance - optimization, rare scenarios
3. Test Code Templates
Ready-to-implement code using e2e_helper.lua:
describe("E2E: [Feature Name]", function()
local nvim_instance
before_each(function()
nvim_instance = helper.spawn_nvim_instance({
headless = true,
init_script = "tests/minimal_init.lua",
})
end)
after_each(function()
helper.cleanup_instance(nvim_instance)
end)
end)
Workflow
- Gather context - Read changed files, analyze scope, review existing tests
- Design scenarios - Generate Happy/Error/Edge/Integration cases
- Prioritize - Rank by Critical/High/Medium/Low
- Generate code - Create implementation-ready test templates
Example Output
For a /export command that exports chat to Markdown:
Test Scenarios
Happy Path โ
Error Cases โ
Edge Cases ๐ธ
Integration Points ๐
Priority Ranking
Critical
- Export basic chat successfully
- Handle permission errors gracefully
High
- Validate file path (security)
- Handle empty chat
Medium
- Export with special characters
Test Code
local helper = require("vibing.testing.e2e_helper")
local TIMEOUTS = {
CHAT_CREATION = 2000,
COMMAND_EXECUTION = 3000,
}
describe("E2E: /export command", function()
local nvim_instance
before_each(function()
nvim_instance = helper.spawn_nvim_instance({
headless = true,
init_script = "tests/minimal_init.lua",
})
end)
after_each(function()
helper.cleanup_instance(nvim_instance)
end)
it("should export chat to markdown file", function()
helper.send_keys(nvim_instance, ":VibingChat<CR>")
vim.wait(TIMEOUTS.CHAT_CREATION)
helper.send_keys(nvim_instance, "GiTest message<Esc><CR>")
local ok = helper.wait_for_buffer_content(
nvim_instance,
"## .* Assistant",
30000
)
assert.is_true(ok, "Assistant should respond")
end)
end)
Best Practices
Do:
- Provide detailed feature description with expected behavior
- List all changed files (
git diff --name-only)
- Review generated scenarios - don't blindly accept
- Implement Critical/High tests first
Don't:
- Use vague descriptions ("Added some features")
- Skip review - templates need customization
- Implement all tests at once - prioritize
Next Steps
After running /test-design:
- Review generated test scenarios
- Approve Critical and High priority tests
- Implement approved tests in
tests/e2e/
- Run
npm run test:e2e
- Apply 3-try auto-fix rule if failures occur (see
.claude/rules/self-testing.md)
References
.claude/rules/self-testing.md - Complete self-testing procedures
lua/vibing/testing/e2e_helper.lua - E2E helper API reference
tests/e2e/chat_basic_flow_spec.lua - Example test suite