ワンクリックで
test-generation
Generate comprehensive test cases for code
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Generate comprehensive test cases for code
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| type | skill |
| name | Test Generation |
| description | Generate comprehensive test cases for code |
| skillSlug | test-generation |
| phases | ["E","V"] |
| generated | "2026-02-08T00:00:00.000Z" |
| status | filled |
| scaffoldVersion | 2.0.0 |
Use this skill when writing tests for Smart Farming use cases, utilities, or entities. The project uses pytest with pytest-describe for BDD-style structure and mock repositories for isolation.
src/app/core/use_cases/{domain}/tests/{use_case_name}_test.pysrc/app/core/commons/tests/{utility_name}_test.pysrc/app/core/use_cases/tests/mocks/import pytest
from core.use_cases.{domain}.{use_case_name} import {UseCaseClass}
from core.use_cases.tests.mocks.repositories import Mock{Domain}Repository
# import other mocks as needed
def describe_{use_case_name}():
@pytest.fixture
def mock_repository():
return Mock{Domain}Repository()
@pytest.fixture
def use_case(mock_repository):
return {UseCaseClass}(repository=mock_repository)
def should_succeed_when_valid_input(use_case, mock_repository):
# Arrange
# ... set up test data in mock repository
# Act
result = use_case.execute(params)
# Assert
assert result is not None
# ... specific assertions
def should_raise_error_when_invalid_input(use_case):
# Arrange & Act & Assert
with pytest.raises(ExpectedError):
use_case.execute(invalid_params)
def should_handle_empty_data(use_case, mock_repository):
# Test edge case with no data
result = use_case.execute(params)
assert result == expected_empty_result
Mocks are in-memory implementations of repository interfaces:
class MockPlantsRepository:
def __init__(self):
self._plants = []
def find_all(self):
return self._plants
def find_by_id(self, plant_id):
return next((p for p in self._plants if p.id == plant_id), None)
def create(self, plant):
self._plants.append(plant)
def update(self, plant):
self._plants = [p if p.id != plant.id else plant for p in self._plants]
def delete(self, plant_id):
self._plants = [p for p in self._plants if p.id != plant_id]
For each use case, generate tests for:
# All tests
pytest
# Specific domain
pytest src/app/core/use_cases/plants/tests/
# Specific test file
pytest src/app/core/use_cases/sensors_records/tests/create_sensor_record_test.py
# Verbose with output
pytest -v -s
# Stop on first failure
pytest -x
*_test.py naming conventiondescribe_ prefix for BDD-style groupingpytest.fixtureDesign RESTful APIs following best practices
Systematic bug investigation and root cause analysis
Review code quality, patterns, and best practices
Generate commit messages following conventional commits with scope detection
Generate and update technical documentation
Break down features into implementable tasks