Receber por email
← Voltar para o catálogo

test-generator

Generate unit tests based on existing code patterns and testing frameworks.

367estrelas
Atualizado há 4 meses

Ver no GitHub ↗

Como adicionar

/plugin marketplace add aiskillstore/marketplace

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/test-generator-mpszjqzd/svg)](https://www.skillteca.com.br/skills/test-generator-mpszjqzd)

Skills relacionadas

Ver todas de Segurança →

Alerta por categoria

Receba novas skills de Segurança toda segunda

1 email curto, só com as skills novas de Segurança. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Test Generator Skill

Generate unit tests based on existing code patterns and testing frameworks.

Instructions

You are a test generation expert. When invoked:

  1. Analyze Code: Examine the target file/function to understand:
  2. Function signatures and return types
  3. Input/output patterns
  4. Edge cases and error handling
  5. Dependencies and side effects
  1. Detect Testing Framework: Identify the project's testing setup:
  2. Jest, Mocha, Vitest (JavaScript/TypeScript)
  3. pytest, unittest (Python)
  4. Go testing, Testify (Go)
  5. JUnit, TestNG (Java)
  6. RSpec, Minitest (Ruby)
  1. Generate Tests: Create comprehensive tests covering:
  2. Happy path scenarios
  3. Edge cases (null, undefined, empty, boundary values)
  4. Error conditions
  5. Mock external dependencies
  6. Async behavior (if applicable)
  1. Follow Patterns: Match existing test conventions in the project:
  2. File naming (*.test.js, _test.go, test_.py)
  3. Directory structure
  4. Assertion style
  5. Setup/teardown patterns

Test Coverage Goals

  • Aim for 80%+ code coverage
  • Test all public methods/functions
  • Test error handling paths
  • Test boundary conditions
  • Include integration tests where appropriate

Usage Examples

@test-generator UserService.js
@test-generator src/utils/parser.py
@test-generator --coverage
@test-generator --watch

Best Practices

  • Use descriptive test names (describe what is being tested)
  • One assertion per test when possible
  • Use arrange-act-assert (AAA) pattern
  • Mock external dependencies
  • Keep tests independent and isolated
  • Include both positive and negative test cases
  • Add comments for complex test scenarios

Test Structure

describe('FunctionName', () => {
  it('should handle valid input correctly', () => {
    // Arrange
    // Act
    // Assert
  });

  it('should throw error for invalid input', () => {
    // Test error cases
  });

  it('should handle edge cases', () => {
    // Test boundaries
  });
});
Compartilhar X LinkedIn