# AI Testing

> AI-powered test generation -- Qodo Cover, coverage-driven generation, Copilot testing, CI/CD integration, and mutation testing with AI.

- Skill: `leolin990405/ai-testing` (Agent Skill)
- Install (CLI): `npx get-skill add leolin990405/ai-testing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leolin990405/ai-testing/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: LeoLin990405 (https://skillmd.com/u/leolin990405)
- Updated: 2026-11-11
- Page: https://skillmd.com/skills/leolin990405/ai-testing

---


# AI Test Generation

## Qodo Cover (CodiumAI)

### CLI Usage
```bash
cover-agent \
  --source-file-path src/calculator.py \
  --test-file-path tests/test_calculator.py \
  --code-coverage-report-path coverage.xml \
  --test-command "pytest --cov=src --cov-report=xml" \
  --coverage-type cobertura \
  --desired-coverage 90 \
  --max-iterations 5 \
  --model gpt-4o
```

### Full Repository Mode
```bash
cover-agent-full-repo \
  --test-folder tests/ \
  --project-root . \
  --test-command "pytest --cov=src --cov-report=xml"
```

### GitHub Actions
```yaml
name: AI Test Coverage
on: [pull_request]
jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: qodo-ai/qodo-ci@main
        with:
          project_language: python
          code_coverage_report_path: coverage.xml
          test_command: "pytest --cov=src --cov-report=xml"
          desired_coverage: 85
```

## Coverage-Driven Approach

1. Run existing tests → identify uncovered lines
2. Feed uncovered code paths to AI with context
3. AI generates targeted tests for uncovered branches
4. Validate generated tests compile and pass
5. Verify coverage increase, iterate

## Copilot Test Generation

```
/tests Generate unit tests for this function including:
- Happy path scenarios
- Edge cases (null, empty, boundary values)
- Error handling paths
```

VS 2026: Built-in for .NET (MSTest, xUnit, NUnit) with before/after coverage stats.

## Best Practices

1. **Review AI tests** — check for meaningful assertions (not just "runs")
2. **Use as starting point** — refine edge cases manually
3. **Coverage gates in CI** — prevent regression
4. **Combine with mutation testing** — verify test quality
5. **Include context files** — `--included-files` for related modules

## Sources

- [Qodo Cover](https://github.com/qodo-ai/qodo-cover)
- [Copilot Testing](https://github.blog/ai-and-ml/github-copilot/how-to-generate-unit-tests-with-github-copilot-tips-and-examples/)

