perl-testing

Write and run Perl test suites using Test2::V0, prove, mocking, and coverage tools.

Updated May 7, 2026
One-click install
npx skills add https://github.com/mirzadham/trainingroombookingsystem2 --skill perl-testing-mirzadham
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: perl-testing
Source: https://github.com/mirzadham/trainingroombookingsystem2/tree/main/.pi/skills/perl-testing
Command: npx skills add https://github.com/mirzadham/trainingroombookingsystem2 --skill perl-testing-mirzadham

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Perl developers often struggle with inconsistent test styles, legacy Test::More patterns, and unclear coverage, leading to fragile test suites and undetected regressions. ## Core Features & Use Cases - Modern Test2::V0 Patterns: Deep comparison builders, subtests, and exception testing with dies/lives for expressive assertions. - Test Runner & Coverage Workflows: prove commands for parallel runs, failure reruns, and Devel::Cover reports with CI thresholds. - Mocking & Isolation: Test::MockModule and Test::MockObject patterns with automatic restoration, plus fixture and subtest isolation guidance. - Use Case: When adding a new feature to a Perl module, follow the red-green-refactor cycle: write a failing Test2::V0 subtest, implement the minimal code, then verify with prove -lv and check coverage with cover -test. ## Quick Start Write a Test2::V0 test file for my Calculator module following TDD and show me the prove command to run it.

Frequently Asked Questions about perl-testing

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

FAQPage Schema
How do I write Perl tests with Test2::V0?▼

Use Test2::V0 with is() for equality, hash and array builders for deep comparison, and subtest blocks to group related assertions. Always end the file with done_testing to verify all planned tests executed.

Test2::V0 vs Test::More for Perl testing?▼

Test2::V0 is the modern replacement for Test::More, offering richer deep-comparison builders, better failure diagnostics, and cleaner subtest scoping. It remains backward-compatible with Test::More tests, so migration can be incremental.

How do I run Perl tests with prove?▼

Run prove -lr t/ to execute all tests recursively with lib/ in @INC. Add -v for verbose output, -j8 for parallel execution, or --state=failed to rerun only previously failing tests.

How do I mock a Perl module in tests?▼

Use Test::MockModule to override methods on a target package; the mock restores automatically when the object goes out of scope. For lightweight test doubles, use Test::MockObject and verify calls with called_ok.

Why does prove fail with 'Can't locate module in @INC'?▼

This happens when prove runs without the -l flag, so modules in lib/ are not in @INC. Run prove -l t/ or add -l to a .proverc file to include the lib directory permanently.

How do I measure Perl test coverage with Devel::Cover?▼

Run cover -test to execute the suite under Devel::Cover and generate a summary, then cover -report html for a browsable report. In CI, parse the text report and fail the build when total coverage drops below your threshold.