gotest

Generate Go unit and integration tests from existing code patterns.

284|10|Updated Dec 6, 2015
One-click install
npx skills add https://github.com/meain/dotfiles --skill gotest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gotest
Source: https://github.com/meain/dotfiles/tree/main/agents/.agents/skills/gotest
Command: npx skills add https://github.com/meain/dotfiles --skill gotest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write Go unit and integration tests by adhering to established patterns within a codebase, ensuring consistency and maintainability.

Core Features & Use Cases

  • Pattern Adherence: Automatically identifies and follows existing testing conventions (mocking, table-driven tests, error assertions).
  • Test Generation: Assists in creating new test cases for Go functions.
  • Verification: Includes steps to compile and run tests to ensure correctness.
  • Use Case: When a new feature is added to a Go service, use this Skill to generate comprehensive tests that match the style of existing tests in the project.

Quick Start

Use the gotest skill to write tests for the processOrder function in the internal/service package.

Frequently Asked Questions about gotest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate Go unit tests that match my existing codebase patterns?

To generate Go unit tests matching existing patterns, analyze your codebase for table-driven structures, mock setups, and error assertions, then replicate those conventions for new functions to ensure consistency and maintainability across your test suite.

What is the best way to write table-driven tests in Go automatically?

Writing table-driven tests in Go automatically requires analyzing existing test conventions in your project and replicating that structure for new test cases, including setting up mock dependencies and following established error assertion patterns to validate function behavior comprehensively.

Can I automatically create integration tests for Go functions?

Yes, you can create integration tests for Go functions by analyzing existing code patterns and replicating them for new test suites, which involves setting up appropriate mock structures, generating test cases, and validating test integrity through compilation and execution checks.

How do I ensure generated Go tests compile and run correctly?

To ensure generated Go tests compile and run correctly, validate test integrity by executing compilation and runtime checks after generation, confirming that newly created table-driven test suites and mock setups function properly within your existing codebase.

Does this approach work with existing mock setups in Go testing?

Yes, this approach works with existing mock setups in Go testing by identifying and following your established mocking conventions, analyzing your current test patterns to generate new test cases that adhere to your specific mock configurations and error assertion styles.