write-char-tests

Generate characterization tests capturing HTTP behavior of domain controllers.

Updated Jul 22, 2023
One-click install
npx skills add https://github.com/ValerianGuivarch/lsr-nestjs-backend --skill write-char-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-char-tests
Source: https://github.com/ValerianGuivarch/lsr-nestjs-backend/tree/main/.claude/skills/write-char-tests
Command: npx skills add https://github.com/ValerianGuivarch/lsr-nestjs-backend --skill write-char-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill automates the generation of characterization tests for HTTP behavior in a domain, enabling the detection of regressions introduced during refactoring.

Core Features & Use Cases

  • Automated Test Generation: Generates .characterization.spec.ts files that capture the current HTTP behavior of a domain's controllers.
  • Regression Detection: Ensures that refactoring does not introduce regressions by comparing current behavior against the captured tests.
  • Use Case: Before refactoring a domain, this Skill can be used to create tests that will help identify any changes in the system's behavior after the refactoring.

Quick Start

Run the write-char-tests skill on the domain 'tips' to generate characterization tests.

Frequently Asked Questions about write-char-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate characterization tests for HTTP behavior in NestJS?

Characterization tests capture a system's current HTTP behavior before refactoring to ensure no regressions are introduced. This skill automates generating `.characterization.spec.ts` files by analyzing controller endpoints and mocking dependencies for accurate regression detection.

Can I automatically create regression tests before refactoring my API controllers?

Yes, you can automatically create regression tests before refactoring API controllers by running the skill on a domain like 'tips'. It captures existing HTTP behavior and outputs test files specifically designed to detect regressions during subsequent refactoring work.

Does this skill require manually mocking dependencies to test controller endpoints?

No, manual mocking is not required as the skill handles mocking dependencies internally. It analyzes the domain's controller endpoints and automatically mocks the necessary dependencies to accurately capture the current HTTP behavior for the characterization tests.

What's the best way to detect HTTP regressions when refactoring a NestJS domain?

The best way to detect HTTP regressions during NestJS refactoring is to establish a baseline using characterization tests. This skill automates the creation of `.characterization.spec.ts` files that capture current endpoint behavior for immediate regression detection.

When do I need to use characterization tests for my HTTP endpoints?

You need to use characterization tests for HTTP endpoints when preparing to refactor a domain and wanting to preserve existing behavior. They act as a safety net by capturing current responses, ensuring any regressions introduced during refactoring are immediately detected.