typo3-testing-skill
The typo3-testing-skill agent is designed to create and manage tests for TYPO3 extensions. It operates on the GitHub platform and is compatible with Claude Code. This agent provides a skill specifically tailored for the TYPO3 content management system. Developers working with TYPO3 extensions can leverage this agent to automate testing processes. It simplifies the creation and maintenance of tests, improving the overall quality and reliability of TYPO3 projects.
Manually creating and managing TYPO3 extension tests can be time-consuming and error-prone. This agent automates these tasks, allowing developers to focus on other aspects of their projects and ensuring more thorough testing coverage.
CAPABILITIES & CONSTRAINTS
USE CASES
README
# TYPO3 Testing Skill
[](https://github.com/netresearch/typo3-testing-skill/releases/tag/v3.0.0)
A comprehensive Claude Code skill for creating and managing TYPO3 extension tests.
## 🔌 Compatibility
This is an **Agent Skill** following the [open standard](https://agentskills.io) originally developed by Anthropic and released for cross-platform use.
**Supported Platforms:**
- ✅ Claude Code (Anthropic)
- ✅ Cursor
- ✅ GitHub Copilot
- ✅ Other skills-compatible AI agents
> Skills are portable packages of procedural knowledge that work across any AI agent supporting the Agent Skills specification.
## Features
- **Test Creation**: Generate Unit, Functional, and E2E tests
- **E2E Testing**: Playwright-based browser automation (TYPO3 Core standard)
- **Accessibility Testing**: axe-core integration for WCAG compliance
- **Infrastructure Setup**: Automated testing infrastructure installation
- **CI/CD Integration**: GitHub Actions and GitLab CI templates
- **Quality Tools**: PHPStan, Rector, php-cs-fixer integration
- **Fixture Management**: Database fixture templates and tooling
- **Test Orchestration**: runTests.sh script pattern from TYPO3 best practices
## Installation
### Marketplace (Recommended)
Add the [Netresearch marketplace](https://github.com/netresearch/claude-code-marketplace) once, then browse and install skills:
```bash
# Claude Code
/plugin marketplace add netresearch/claude-code-marketplace
```
### npx ([skills.sh](https://skills.sh))
Install with any [Agent Skills](https://agentskills.io)-compatible agent:
```bash
npx skills add https://github.com/netresearch/typo3-testing-skill --skill typo3-testing
```
### Download Release
Download the [latest release](https://github.com/netresearch/typo3-testing-skill/releases/latest) and extract to your agent's skills directory.
### Git Clone
```bash
git clone https://github.com/netresearch/typo3-testing-skill.git
```
### Composer (PHP Projects)
```bash
composer require netresearch/typo3-testing-skill
```
Requires [netresearch/composer-agent-skill-plugin](https://github.com/netresearch/composer-agent-skill-plugin).
## Quick Start
1. **Setup testing infrastructure:**
```bash
cd your-extension
~/.claude/skills/typo3-testing/scripts/setup-testing.sh
```
2. **Generate a test:**
```bash
~/.claude/skills/typo3-testing/scripts/generate-test.sh unit MyService
```
3. **Run tests:**
```bash
Build/Scripts/runTests.sh -s unit
composer ci:test
```
## Test Types
### Unit Tests
Fast, isolated tests without external dependencies. Perfect for testing services, utilities, and domain logic.
### Functional Tests
Tests with database and full TYPO3 instance. Use for repositories, controllers, and integration scenarios.
### E2E Tests (Playwright)
Browser-based end-to-end tests using Playwright (TYPO3 Core standard). For testing complete user workflows, backend modules, and accessibility compliance with axe-core.
## Advanced Testing Patterns
### Advanced PHPUnit Configuration
The tea extension demonstrates production-grade PHPUnit configuration with parallel execution, strict mode, and comprehensive coverage analysis.
#### Parallel Test Execution
PHPUnit 10+ supports parallel test execution for significant performance improvements:
**Configuration** (`Build/phpunit/UnitTests.xml`):
```xml
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../.Build/vendor/phpunit/phpunit/phpunit.xsd"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnFailure="false"
beStrictAboutTestsThatDoNotTestAnything="true"
colors="true"
cacheDirectory=".Build/.phpunit.cache">
<testsuites>
<testsuite name="Unit Tests">
<directory>../../Tests/Unit/</directory>
</testsuite>
</testsuites>
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile=".Build/coverage/clover.xml"/>
<html outputDirectory=".Build/coverage/html"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
</report>
</coverage>
</phpunit>
```
**Key Features**:
- **`executionOrder="random"`**: Detects hidden test dependencies by randomizing test order
- **`failOnRisky="true"`**: Treats risky tests as failures (tests without assertions)
- **`failOnWarning="true"`**: Fails on warnings like deprecated function usage
- **`beStrictAboutTestsThatDoNotTestAnything="true"`**: Ensures every test has assertions
#### Separate Unit and Functional Configurations
The tea extension maintains separate PHPUnit configurations:
**Unit Tests** (`Build/phpunit/UnitTests.xml`):
- No database bootstrap
- Fast execution (milliseconds per test)
- Strict mode enabled
- Code coverage analysis
**Functional Tests** (`Build/phpunit/FunctionalTests.xml`):
- Database bootstrap included
- TYPO3 testing framework integration
- SQLite for fast in-memory testing
- Test doubles for external services
Example functional test configuration:
```xml
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../.Build/vendor/phpunit/phpunit/phpunit.xsd"
stopOnFailure="false"
colors="true"
cacheDirectory=".Build/.phpunit.cache">
<testsuites>
<testsuite name="Functional Tests">
<directory>../../Tests/Functional/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="1"/>
<env name="TYPO3_CONTEXT" value="Testing"/>
</php>
</phpunit>
```
#### Coverage Thresholds
Enforce minimum coverage requirements via composer scripts:
```json
{
"scripts": {
"ci:coverage:check": [
"@ci:tests:unit",
"phpunit --configuration Build/phpunit/UnitTests.xml --coverage-text --coverage-clover=.Build/coverage/clover.xml",
"phpunit-coverage-check .Build/coverage/clover.xml 70"
]
}
}
```
**Progressive Coverage Targets**:
- MVP Extensions: 50% minimum
- Production Extensions: 70% minimum
- Reference Extensions: 80%+ target
### CSV Fixture and Assertion Pattern
The tea extension demonstrates an elegant CSV-based pattern for functional test fixtures, significantly improving test readability and maintainability.
#### Problem Statement
Traditional fixture loading in TYPO3 functional tests uses SQL files or PHP arrays:
```php
// ❌ Traditional approach: Verbose and hard to read
protected function setUp(): void
{
parent::setUp();
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/pages.csv');
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/tt_content.csv');
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/tx_tea_domain_model_product_tea.csv');
}
```
#### CSV Fixture Pattern
**Fixture File** (`Tests/Functional/Fixtures/Database/tea.csv`):
```csv
tx_tea_domain_model_product_tea
uid,pid,title,description,owner
1,1,"Earl Grey","Classic black tea",1
2,1,"Green Tea","Organic green tea",1
3,2,"Oolong Tea","Traditional oolong",2
```
**Loading in Test**:
```php
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
final class TeaRepositoryTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/tea',
];
protected function setUp(): void
{
parent::setUp();
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/tea.csv');
}
/**
* @test
*/
public function findAllReturnsAllRecords(): void
{
$result = $this->subject->findAll();
self::assertCount(3, $result);
}
}
```
#### CSV Assertion Pattern
**Even More Powerful**: Assert database state using CSV format:
**Expected State File** (`Tests/Functional/Fixtures/Database/AssertTeaAfterCreate.csv`):
```csv
tx_tea_domain_model_product_tea
uid,pid,title,description,owner
1,1,"Earl Grey","Classic black tea",1
2,1,"Green Tea","Organic green tea",1
[truncated…]PUBLIC HISTORY
IDENTITY
Identity inferred from code signals. No PROVENANCE.yml found.
Is this yours? Claim it →METADATA
README BADGE
Add to your README:
