FreePascal/Lazarus Test-Driven Development (TDD) e FPCUnit

Enforce Red-Green-Refactor TDD workflows with FPCUnit in FreePascal/Lazarus.

17|7|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/delphicleancode/lazarus-spec-kit --skill freepascal-lazarus-test-driven-development-tdd-e-fpcunit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: FreePascal/Lazarus Test-Driven Development (TDD) e FPCUnit
Source: https://github.com/delphicleancode/lazarus-spec-kit/tree/main/.gemini/skills/tdd-fpcunit
Command: npx skills add https://github.com/delphicleancode/lazarus-spec-kit --skill freepascal-lazarus-test-driven-development-tdd-e-fpcunit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It provides clear guidelines for how an AI should behave when assisting with Test-Driven Development in FreePascal/Lazarus using FPCUnit, ensuring tests are written before business logic and encouraging safe, mock-driven designs.

Core Features & Use Cases

  • Enforces the Red-Green-Refactor cycle for TDD in FreePascal/Lazarus with FPCUnit.
  • Guides the creation and use of interface-based fakes/mocks to isolate units under test.
  • Establishes naming conventions, SetUp/TearDown usage, and strong assertions to improve test reliability.

Quick Start

Draft a failing FPCUnit test for the system under test, implement the minimal code to pass the test, and refactor for readability.

Frequently Asked Questions about FreePascal/Lazarus Test-Driven Development (TDD) e FPCUnit

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

FAQPage Schema
How do I write unit tests in FreePascal and Lazarus using FPCUnit?

Unit testing in FreePascal and Lazarus uses FPCUnit to establish test structure, naming conventions, and SetUp/TearDown methods. You create deterministic, testable code by drafting strong assertions that verify business logic.

How do I create mocks in FreePascal to isolate units during TDD?

Mocks in FreePascal are created using ARC-aware interfaces to isolate units under test. This approach allows you to build interface-based fakes that safely substitute dependencies when following the Red-Green-Refactor cycle.

What is the best way to start Test-Driven Development in Lazarus?

Starting TDD in Lazarus involves drafting a failing FPCUnit test for the system under test before writing any implementation. You then implement the minimal code required to pass the test and refactor for readability.

How does the Red-Green-Refactor cycle apply to FreePascal projects?

The Red-Green-Refactor cycle in FreePascal enforces writing failing FPCUnit tests before implementing business logic. This workflow ensures your code remains testable and encourages safe, mock-driven designs through structured iterations.

Do I need to use interfaces for mocking in FPCUnit?

Using interfaces for mocking in FPCUnit is essential to support deterministic, testable code. ARC-aware interfaces allow you to create reliable fakes that isolate your units under test without breaking memory management.

Why are my FPCUnit tests failing when adding new features to existing FreePascal code?

FPCUnit tests fail when business logic is written before tests, breaking the TDD workflow. You must enforce test structure and strong assertions first, ensuring new features pass through the Red-Green-Refactor cycle.