Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Unit & Integration Test Generator skill

    1

    Generate behavior-focused unit and integration tests designed to catch real defects and edge cases.

    $9.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Unit & Integration Test Generator skill

    Unit & Integration Test Generator skill

    Example session with this skill installed

    Generate unit tests for this TypeScript function that calculates a loyalty discount. It takes a 'user' object and 'cartTotal'. Logic: 10% off if user is 'PRO', 5% if orders > 10. Max discount $50.

    • Read your context and instructions
    • Compiled the unit & integration

    Analyzed loyalty discount logic. Identified risks in discount stacking, max cap boundaries, and missing user properties.

    Test Suite: Loyalty Discount Calculator

    import { calculateDiscount, User } from './loyalty';
    
    describe('calculateDiscount', () => {
      // Behavior: PRO users get 10% discount
      test('should apply 10% discount for PRO status regardless of order count', () => {
        const user: Partial<User> = { status: 'PRO', orderCount: 2 };
        const result = calculateDiscount(user as User, 100);
        expect(result).toBe(10);
      });
    
      // Behavior: High volume users get 5% discount
      test('should apply 5% discount for users with > 10 orders', () => {
        const user: Partial<User> = { status: 'BASIC', orderCount: 11 };
        const result = calculateDiscount(user as User, 200);
        expect(result).toBe(10);
      });
    
      // Boundary: Max discount cap
      test('should cap the discount at $50 for large PRO orders', () => {
        const user: Partial<User> = { status: 'PRO', orderCount: 5 };
        const result = calculateDiscount(user as User, 1000);
        expect(result).toBe(50);
      });
    
      // Negative Path: No discount for low volume BASIC users
      test('should return 0 discount for BASIC users with exactly 10 orders', () => {
        const user: Partial<User> = { status: 'BASIC', orderCount: 10 };
        const result = calculateDiscount(user as User, 100);
        expect(result).toBe(0);
      });
    
      // Risk: Malformed input
      test('should return 0 for negative cart totals', () => {
        const user: Partial<User> = { status: 'PRO', orderCount: 15 };
        const result = calculateDiscount(user as User, -100);
        expect(result).toBe(0);
      });
    });
    

    Why these tests matter

    • Boundary Cap Test: Targeted at a mutation where the $50 constant is ignored or incorrectly compared.
    • Order Count 10 Test: Specifically catches off-by-one errors (e.g., using >= instead of >).

    Next steps

    • Verify the User interface matches the Partial properties used in mocks.
    • Add an integration test to ensure cartTotal is rounded before discount calculation.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Testing scripts often fail to catch real bugs because they focus on implementation details rather than observable behavior. This skill acts as a senior test engineer to generate unit and integration tests designed specifically to detect defects, not just increase coverage percentages.

    What it does

    • Behavioral testing focuses on API contracts, invariants, and side effects rather than internal implementation.
    • Risk identification analyzes branches, boundaries, and state transitions to find high-probability failure points.
    • Multi-level generation produces both isolated unit tests and integration tests for real service boundaries.
    • Defect targeting explains exactly which plausible mutation or bug each test case is designed to catch.
    • Assertion auditing reviews tests for tautological checks or brittle mocks that create false confidence.

    How it works

    1. Analyze input to summarize the contract, preconditions, and postconditions of your code or API.
    2. Draft a test plan ranking scenarios by risk, including happy paths, boundaries, and failure states.
    3. Generate test code using your project's conventions, imports, and preferred test runner.
    4. Audit for weaknesses by suggesting mutation ideas and identifying potential flakiness or over-mocking.

    Frameworks & tools

    Works with any language and test runner, including Jest, Vitest, Pytest, JUnit, Mocha, and Go testing. It adapts to specific project styles for mocking libraries and assertion patterns.

    Why this beats prompting it yourself

    Standard prompts often produce "happy path" tests that pass even when logic is broken. This skill uses mutation-oriented thinking to ensure assertions actually fail when behavior changes, preventing the creation of a suite that provides a false sense of security.

    Use cases

    • Generate test suites for complex business logic with multiple edge cases.
    • Create integration tests for service boundaries and persistence layers.
    • Refactor brittle tests that break every time internal code is touched.
    • Build negative test cases for error handling and authorization logic.

    Known limitations

    Cannot execute tests or provide real coverage data without access to a runtime environment. It relies on the buyer to provide API contracts or source code for context.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scanned

    Verified clean today

    • Passed all security checks, Safe to install

    Listedtoday

    What's inside

    Frequently Asked Questions