affaan-m avatar

Perl Testing

This one walks you through Perl testing with Test2::V0 and Test::More, covering the full TDD cycle from red-green-refactor onwards. You get concrete examples of deep comparisons using hash and array builders, mocking with Test::MockModule (with clear warnings against monkey-patching), and coverage reports via Devel::Cover. The prove runner commands are practical, including parallel execution and state management for CI. Activate it when writing new Perl code or migrating legacy test suites. The subtest patterns and fixture setup examples are immediately useful, and the side-by-side Test::More versus Test2 comparisons make migration decisions straightforward.

skills.sh installs
5.4K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill perl-testing --agent claude-code

Installs into .claude/skills of the current project.

Files

Perl Testing Patterns

Comprehensive testing strategies for Perl applications using Test2::V0, Test::More, prove, and TDD methodology.

When to Activate

  • Writing new Perl code (follow TDD: red, green, refactor)
  • Designing test suites for Perl modules or applications
  • Reviewing Perl test coverage
  • Setting up Perl testing infrastructure
  • Migrating tests from Test::More to Test2::V0
  • Debugging failing Perl tests

TDD Workflow

Always follow the RED-GREEN-REFACTOR cycle.

# Step 1: RED — Write a failing test
# t/unit/calculator.t
use v5.36;
use Test2::V0;

use lib 'lib';
use Calculator;

subtest 'addition' => sub {
    my $calc = Calculator->new;
    is($calc->add(2, 3), 5, 'adds two numbers');
    is($calc->add(-1, 1), 0, 'handles negatives');
};

done_testing;

# Step 2: GREEN — Write minimal implementation
# lib/Calculator.pm
package Calculator;
use v5.36;
use Moo;

sub add($self, $a, $b) {
    return $a + $b;
}

1;

# Step 3: REFACTOR — Improve while tests stay green
# Run: prove -lv t/unit/calculator.t

Test::More Fundamentals

The standard Perl testing module — widely used, ships with core.

Basic Assertions

use v5.36;
use Test::More;

Sponsors

Details

Repository
github.com/affaan-m/ecc
Category
Testing & QA
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263
1dotnet avatartest-anti-patternsdotnet/skillsAudits an existing test file or suite in any language for anti-patterns and quality issues — produces a severity-ranked report (Critical/Warning/Info). INVOKE w5.3Kskills.sh installs
2forcedotcom avatardx-devops-test-pipeline-configureforcedotcom/sf-skillsConfigures DevOps Center pipeline testing infrastructure: enables a test provider so its suites become available, re-syncs a configured provider to pull in new 5.1Kskills.sh installs
3dotnet avatarcode-testing-agentdotnet/skillsMANDATORY ENTRY POINT for generating or writing tests. Invoke this skill before editing files whenever the user asks to generate tests, write/add unit tests, sc4.7Kskills.sh installs
4dpearson2699 avatarswift-testingdpearson2699/swift-ios-skillsWrites and migrates Swift Testing framework tests with @Test, @Suite, #expect, #require, confirmation, traits, withKnownIssue, Attachment.record, processExitsWi4.5Kskills.sh installs
5lobehub avatartestinglobehub/lobehubVitest testing guide. Use when writing or updating tests, fixing failing tests, improving coverage, debugging test issues, or setting up mocks.4.3Kskills.sh installs
6amelnagdy avatartest-guardamelnagdy/guard-skillsReview generated or changed test code against universal testing rules before it ships. Best used reactively after an agent writes, edits, generates, or refactor4.3Kskills.sh installs