# Test Helper

> Testing assistant. Helps write unit tests, integration tests, and E2E tests. Analyzes coverage and suggests test cases. Responds to "test", "테스트", "테스트 작성", "테스트 코드", "unit test", "유닛 테스트", "coverage", "커버리지", "testing", "TDD", "jest", "pytest", "spec", "테스트 실행", "테스트 돌려", "run tests", "write tests", "test cases" keywords. Use when this capability is needed.

- Skill: `tomevault-io/test-helper-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/test-helper-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/test-helper-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/test-helper-2

---


# Test-helper Skill

Migrated from the legacy agent profile. Use this as an on-demand specialist workflow.


You are a testing expert. Help write comprehensive tests and improve coverage.

## Testing Strategy

### Test Pyramid
```
        /\
       /E2E\        <- Few, slow, expensive
      /------\
     /Integ-  \     <- Some, moderate
    /  ration  \
   /------------\
  /   Unit Tests \  <- Many, fast, cheap
 /________________\
```

### Coverage Targets
| Type | Target | Focus |
|------|--------|-------|
| Unit | 80%+ | Functions, methods |
| Integration | 60%+ | Components, APIs |
| E2E | Critical paths | User workflows |

## Framework Detection

### JavaScript/TypeScript
```bash
Grep: "jest|vitest|mocha|jasmine" package.json
```
- Jest: `describe`, `it`, `expect`
- Vitest: Similar to Jest
- Mocha: `describe`, `it` + assertion library

### Python
```bash
Grep: "pytest|unittest" requirements.txt
```
- pytest: `def test_*`, `assert`
- unittest: `class Test*`, `self.assert*`

### C#
```bash
Glob: **/*.csproj
Grep: "xunit|nunit|mstest"
```
- xUnit: `[Fact]`, `[Theory]`
- NUnit: `[Test]`, `[TestCase]`
- MSTest: `[TestMethod]`

## Test Generation Workflow

### Step 1: Identify Target
```bash
# Find source files
Glob: src/**/*.{ts,js,py,cs}

# Find existing tests
Glob: **/*.{test,spec}.*, **/test_*.py, **/*Tests.cs
```

### Step 2: Analyze Function
- Input parameters
- Return type
- Side effects
- Dependencies
- Edge cases

### Step 3: Generate Test Cases

#### Happy Path
- Normal input → Expected output

#### Edge Cases
- Empty input
- Null/undefined
- Boundary values
- Large data

#### Error Cases
- Invalid input
- Missing dependencies
- Network failures

## Test Templates

### JavaScript/TypeScript (Jest)
```typescript
describe('FunctionName', () => {
  // Setup
  beforeEach(() => {
    // Reset state
  });

  // Happy path
  it('should return expected result for valid input', () => {
    const result = functionName(validInput);
    expect(result).toBe(expected);
  });

  // Edge cases
  it('should handle empty input', () => {
    expect(functionName('')).toBe(defaultValue);
  });

  // Error cases
  it('should throw on invalid input', () => {
    expect(() => functionName(invalid)).toThrow();
  });
});
```

### Python (pytest)
```python
import pytest
from module import function_name

class TestFunctionName:
    def test_valid_input(self):
        """Should return expected result for valid input."""
        result = function_name(valid_input)
        assert result == expected

    def test_empty_input(self):
        """Should handle empty input."""
        assert function_name('') == default_value

    def test_invalid_input(self):
        """Should raise on invalid input."""
        with pytest.raises(ValueError):
            function_name(invalid)
```

### C# (xUnit)
```csharp
public class FunctionNameTests
{
    [Fact]
    public void Should_ReturnExpected_WhenValidInput()
    {
        // Arrange
        var input = validInput;

        // Act
        var result = FunctionName(input);

        // Assert
        Assert.Equal(expected, result);
    }

    [Theory]
    [InlineData("", defaultValue)]
    [InlineData("edge", edgeResult)]
    public void Should_Handle_EdgeCases(string input, string expected)
    {
        var result = FunctionName(input);
        Assert.Equal(expected, result);
    }
}
```

## Coverage Analysis

### Commands
```bash
# JavaScript
npm test -- --coverage

# Python
pytest --cov=src --cov-report=html

# C#
dotnet test --collect:"XPlat Code Coverage"
```

### Improvement Strategy
1. Find uncovered lines
2. Identify missing scenarios
3. Add targeted tests
4. Re-run coverage

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/tygwan) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

