Testing Skill

Automatiza pruebas y diagnósticos del sistema SmartK et sin perder tiempo

16 stars

Best use case

Testing Skill is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Automatiza pruebas y diagnósticos del sistema SmartK et sin perder tiempo

Teams using Testing Skill should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/testing-skill/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/testing-skill/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/testing-skill/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Testing Skill Compares

Feature / AgentTesting SkillStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Automatiza pruebas y diagnósticos del sistema SmartK et sin perder tiempo

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Testing Skill - SmartKet ERP

## 🎯 Propósito

Esta skill facilita la **creación, ejecución y mantenimiento de pruebas** en SmartKet, integrando los scripts existentes de `/Pruebas` y proporcionando templates para tests automatizados.

## 🧪 Estrategia de Testing

### Pirámide de Testing

```
         /\
        /E2E\         ← Pocos, críticos (Dusk, flow completo)
       /------\
      /  API  \       ← Moderados (Feature tests, endpoints)
     /----------\
    /   UNIT     \    ← Muchos, rápidos (Services, Models)
   /--------------\
```

**Regla**: 70% Unit, 20% API, 10% E2E

### Tipos de Prueba en SmartKet

1. **Unit Tests** - Lógica de Services y Modelos
2. **Feature Tests** - Endpoints API completos
3. **Database Tests** - Migraciones y seeders
4. **Frontend Tests** - Componentes Vue (Vitest)
5. **Integration Tests** - Flujos multi-tenant

---

## 📋 Checklist de Testing

### Antes de Commit
- [ ] Tests de la funcionalidad nueva/modificada pasan
- [ ] Tests existentes no se rompieron
- [ ] Coverage mínimo: 60% en Services

### Antes de Deploy
- [ ] Suite completa ejecutada (`test-all.ps1`)
- [ ] Tests de integración multi-tenant pasados
- [ ] Diagnósticos de API (`api-tester.php`) OK
- [ ] Tests de navegador críticos (login, registro) OK

---

## 🛠️ Scripts de Testing

### 1. Ejecutar Suite Completa
```bash
.\. agent\skills\testing\scripts\test-runner.ps1
```

**Qué hace**: 
- Tests PHPUnit (backend)
- Tests Vitest (frontend)
- Diagnosis de API
- Diagnosis de DB

### 2. Probar Endpoints API
```bash
cd smartket-api
php ..\.agent\skills\testing\scripts\api-tester.php
```

**Qué hace**: Prueba endpoints críticos con datos reales

### 3. Diagnóstico de Base de Datos
```bash
cd smartket-api
php ..\.agent\skills\testing\scripts\db-diagnostics.php
```

**Qué hace**: Verifica esquemas landlord y tenant

---

## 📚 Templates de Tests

### Feature Test Template
Ver: `.agent/skills/testing/examples/feature-test-example.php`

```php
// Test de endpoint API
test('can create product', function () {
    $response = $this->postJson('/api/products', [
        'name' => 'Test Product',
        'price' => 99.99
    ]);
    
    $response->assertStatus(201)
             ->assertJsonStructure(['id', 'name', 'price']);
});
```

### Unit Test Template
Ver: `.agent/skills/testing/examples/unit-test-example.php`

```php
// Test de Service
test('ProductService creates product correctly', function () {
    $service = new ProductService();
    $product = $service->create(['name' => 'Test', 'price' => 50]);
    
    expect($product)->toBeInstanceOf(Product::class)
                    ->and($product->name)->toBe('Test');
});
```

---

## 🚨 Tests Críticos Obligatorios

### Backend
1. **Auth**: Login, logout, token refresh
2. **Multi-Tenant**: Aislamiento de datos
3. **RBAC**: Permisos granulares
4. **Business Logic**: Cálculos de ventas, stock

### Frontend
1. **Login Flow**: Desde landing hasta app
2. **Dashboard**: Carga correcta de datos
3. **Components**: Buttons, modals, forms

---

## 📖 Integración con /Pruebas

Los scripts de `/Pruebas` existentes están integrados:

- `diagnostico-usuario.php` → Verificar usuarios'
- `simular-login.php` → Test manual de auth
- `test-cors.ps1` → Validar CORS
- `README.md` → Documentación de uso

Usar estos para debugging manual cuando los tests automatizados fallen.

---

## 🎓 Cuándo Usar Esta Skill

✅ **Usar cuando**:
- Agregues nueva funcionalidad (TDD)
- Refactorices código existente
- Debuggees error de producción
- Prepares deployment

❌ **No reemplaza**:
- Testing manual de UX
- Code review humano

---

## 💡 Best Practices

1. **Tests rápidos**: Unit tests < 100ms
2. **Tests aislados**: No depender de orden
3. **Data factories**: Usa factories para datos de prueba
4. **Cleanup**: Tests deben limpiar lo que crean
5. **Descriptivos**: Nombre debe describir qué prueba

```php
// ❌ Malo
test('test 1', function () { ... });

// ✅ Bueno
test('customer can purchase product when in stock', function () { ... });
```

Related Skills

typescript-testing

16
from diegosouzapw/awesome-omni-skill

Comprehensive testing guidance for TypeScript projects including unit testing patterns, mocking strategies, and test organization best practices

testing-tauri-apps

16
from diegosouzapw/awesome-omni-skill

Guides developers through testing Tauri applications including unit testing with mock runtime, mocking Tauri APIs, WebDriver end-to-end testing with Selenium and WebdriverIO, and CI integration with GitHub Actions.

testing-strategy-python

16
from diegosouzapw/awesome-omni-skill

Python/FastAPI/Django testing conventions. pytest, fixtures, httpx, TestClient, factory_boy. Use when writing or reviewing Python tests.

testing-strategy-builder

16
from diegosouzapw/awesome-omni-skill

Use this skill when creating comprehensive testing strategies for applications. Provides test planning templates, coverage targets, test case structures, and guidance for unit, integration, E2E, and performance testing. Ensures robust quality assurance across the development lifecycle.

testing-skills-activation

16
from diegosouzapw/awesome-omni-skill

Use when creating or refining Claude Code skills to validate that skill descriptions trigger correctly - provides systematic testing methodology for skill activation patterns using test cases and automated evaluation

testing-qa

16
from diegosouzapw/awesome-omni-skill

Comprehensive testing and QA workflow covering unit testing, integration testing, E2E testing, browser automation, and quality assurance.

testing-principles

16
from diegosouzapw/awesome-omni-skill

Language-agnostic testing principles including TDD, test quality, coverage standards, and test design patterns. Use when writing tests, designing test strategies, or reviewing test quality.

testing-patterns

16
from diegosouzapw/awesome-omni-skill

TDD and unit testing guidance for Crispy CRM. Use when writing tests, implementing TDD, debugging test failures, or setting up test infrastructure. Covers Vitest patterns, React Admin component testing, Zod schema validation testing, Supabase mocking, E2E with Playwright, and manual E2E testing with Claude Chrome. Integrates with verification-before-completion for test verification.

testing-builder

16
from diegosouzapw/awesome-omni-skill

Automatically generates comprehensive test suites (unit, integration, E2E) based on code and past testing patterns. Use when user says "write tests", "test this", "add coverage", or after fixing bugs to create regression tests. Eliminates testing friction for ADHD users.

Testing Anti-Patterns

16
from diegosouzapw/awesome-omni-skill

This skill should be used when encountering "flaky tests", "test maintenance issues", "slow test suites", "brittle tests", "test code smells", "test debugging problems", or when tests are hard to understand, maintain, or debug.

spring-boot-testing

16
from diegosouzapw/awesome-omni-skill

No description provided.

screen-reader-testing

16
from diegosouzapw/awesome-omni-skill

Test web applications with screen readers including VoiceOver, NVDA, and JAWS. Use when validating screen reader compatibility, debugging accessibility issues, or ensuring assistive technology supp...