Test::...ration(3pm)
π NAME π
Test::BDD::Cucumber::Manual::Integration β aka the Test suite integration options page, straight outta the User Contributed Perl Documentation (3pm) crew. Bestie, this is your guide to making Cucumber-ish tests play nice with your test suite. π₯β¨
πΈ VERSION πΈ
version 0.87 β yes queen, that's the one. π
π¦ DESCRIPTION π¦
How to use Test::BDD::Cucumber in your test suite. That's it, that's the whole vibe. π«Ά
β¨ OVERVIEW β¨
So Test::BDD::Cucumber gives you two whole options for integrating your tests with your test framework, and honestly? Both are valid:
- Integration with
proveβ which will run your.featurefiles as it does.tfiles π - Creation of a
.tfile which fires off your selected.featurefiles (the Test::Builder integration) π₯
The benefits from using the former approach (the prove one, the first one, keep up bestie) is that all of prove's advanced features β like parallel testing, randomized order, --stateful runs, JUnit output, etc. β are available out of the box. No extra setup, no cap. π
π prove integration
With Test::BDD::Cucumber installed in the Perl search path (PERL5LIB), you unlock the possibility to run the .feature files with a prove command directly, by specifying:
$ prove -r
--source Feature
--ext=.feature
--feature-option tags=~@wip
t/
This command registers a prove plugin named Feature associated with the .feature extension. Additionally, it passes a tag filter to exclude @wip tagged features and scenarios from being run. Not me excluding the work-in-progress stuff, iconic behaviour honestly. π
When executed, the command searches the t/ directory recursively for files with the .feature extension. For each directory holding at least one .feature file, the step files are loaded from the step_definitions/ subdirectory. So it just finds them, iykyk. π§
The command above will find and run only .feature files. When you want to run your regular .t files as well as Test::BDD::Cucumber's .feature files, run the following command:
$ prove -r
--source Perl
--ext=.t
--source Feature
--ext=.feature
--feature-option tags=~@wip
t/
Two sources, two extensions, one command. Slay. π
π Test::Builder integration -- a documented example
The code below needs to be stored in a .t file in the t/ or xt/ directory. When done that way, the tests are integrated into make test as generated from make test after perl Makefile.PL. So like... put it where it belongs and the whole machine just works, bestie. β¨
#!perl
use strict;
use warnings;
# This will find step definitions and feature files in the directory you point
# it at below
use Test::BDD::Cucumber::Loader;
# This harness prints out nice TAP
use Test::BDD::Cucumber::Harness::TAP;
# Load a directory with Cucumber files in it. It will recursively execute any
# file matching .*_steps.pl as a Step file, and .*\.feature as a feature file.
# The features are returned in @features, and the executor is created with the
# step definitions loaded.
my ( $executor, @features ) = Test::BDD::Cucumber::Loader->load(
't/cucumber_core_features/' );
# Create a Harness to execute against. TAP harness prints TAP
my $harness = Test::BDD::Cucumber::Harness::TAP->new({});
# For each feature found, execute it, using the Harness to print results
$executor->execute( $_, $harness ) for @features;
# Shutdown gracefully
$harness->shutdown();
Notice the shutdown() at the end β shut down gracefully, bestie, always. π
That's the whole page, no filler, all facts intact. This cutie was brought to you by perl v5.40.1, dated 2025-05-29, and it lives under the name Test::...ration(3pm) in the User Contributed Perl Documentation set. Go forth and integrate, you main character. πππ¦
π¦ where this page comes from
- debian trixie: libtest-bdd-cucumber-perl 0.87-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-bdd-cucumber-perl 0.87-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-bdd-cucumber-perl 0.87-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms