Skip to content
Back to skills

Unit Test Generator

ASecurity

Generate automated unit test suites (Jest, Pytest, Go test) with complete mocking.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 27, 2026
developmentpythongobashnodetesting

Works with

  • cli

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add RMAzrim/opencode-artes --skill unit-test-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unit Test Generator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unit Test Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/rmazrim-unit-test-generator/badge)](https://www.skillsdirectory.com/skills/rmazrim-unit-test-generator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Unit Test Generator
description: Generate automated unit test suites (Jest, Pytest, Go test) with complete mocking.
metadata:
  source: skills/unit-test-generator/unit-test-generator.md
---

# Unit Test Generator

## Prerequisites & Dependencies
- Language runtime matching the project: Node.js 18+ (Jest/Vitest), Python 3.10+ (pytest, pytest-mock), or Go 1.21+
- Coverage tooling configured in the project (`c8`/Istanbul, `pytest-cov`, or `go test -cover`)
- Existing test conventions (directory layout, config files) so new tests match the repo setup

## Execution Steps
1. Inventory the units under test and classify their dependencies: pure logic, I/O (DB, HTTP, filesystem), time, and randomness.
2. Derive test cases per unit: happy path, boundary values, invalid inputs, error propagation, and state transitions.
3. Replace external dependencies with mocks/stubs; assert interactions (call count, arguments) only where they are part of the unit's contract.
4. Write tests using the project's framework with arrange-act-assert structure and behavior-describing test names.
5. Run the suite with coverage; add cases until all public branches are exercised, without testing implementation internals.
6. Ensure determinism: seed randomness, inject clocks instead of real time, and keep tests order-independent.

```python
import pytest
from unittest.mock import MagicMock
from orders.service import OrderService

def test_place_order_charges_and_persists():
    payments, repo = MagicMock(), MagicMock()
    svc = OrderService(payments=payments, repo=repo)

    order = svc.place_order(user_id=7, items=[("sku-1", 2)], price=10)

    payments.charge.assert_called_once_with(user_id=7, amount=20)
    repo.save.assert_called_once_with(order)
    assert order.total == 20

def test_place_order_propagates_payment_failure():
    payments = MagicMock()
    payments.charge.side_effect = RuntimeError("declined")
    svc = OrderService(payments=payments, repo=MagicMock())

    with pytest.raises(RuntimeError, match="declined"):
        svc.place_order(user_id=7, items=[("sku-1", 1)], price=5)
```

```bash
pytest --cov=orders --cov-report=term-missing -q
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.