1Test::Data::Split(3) User Contributed Perl Documentation Test::Data::Split(3)
2
3
4
6 Test::Data::Split - split data-driven tests into several test scripts.
7
9 version 0.2.2
10
12 use Test::Data::Split;
13
14 # Implements Test::Data::Split::Backend::Hash
15 use MyTest;
16
17 my $tests_dir = "./t";
18
19 my $obj = Test::Data::Split->new(
20 {
21 target_dir => $tests_dir,
22 filename_cb => sub {
23 my ($self, $args) = @_;
24
25 my $id = $args->{id};
26
27 return "valgrind-$id.t";
28 },
29 contents_cb => sub {
30 my ($self, $args) = @_;
31
32 my $id = $args->{id};
33
34 return <<"EOF";
35 #!/usr/bin/perl
36
37 use strict;
38 use warnings;
39
40 use Test::More tests => 1;
41 use MyTest;
42
43 @{['# TEST']}
44 MyTest->run_id(qq#$id#);
45
46 EOF
47 },
48 data_obj => MyTest->new,
49 }
50 );
51
52 $obj->run;
53
54 # And later in the shell:
55 prove t/*.t
56
58 This module splits a set of data with IDs and arbitrary values into one
59 test file per (key+value) for easy parallelisation.
60
62 my $obj = Test::Data::Split->new({ %PARAMS })
63 Accepts the following parameters:
64
65 • target_dir
66
67 The path to the target directory - a string.
68
69 • filename_cb
70
71 A subroutine references that accepts "($self, {id => $id })" and
72 returns the filename.
73
74 • contents_cb
75
76 A subroutine references that accepts "($self, {id => $id, data =>
77 $data })" and returns the contents inside the file.
78
79 • data_obj
80
81 An object reference that implements the "->list_ids()" methods that
82 returns an array reference of IDs to generate as files.
83
84 An example for using it can be found in the synopsis.
85
86 $self->run()
87 Generate the files.
88
90 Websites
91 The following websites have more information about this module, and may
92 be of help to you. As always, in addition to those websites please use
93 your favorite search engine to discover more resources.
94
95 • MetaCPAN
96
97 A modern, open-source CPAN search engine, useful to view POD in
98 HTML format.
99
100 <https://metacpan.org/release/Test-Data-Split>
101
102 • RT: CPAN's Bug Tracker
103
104 The RT ( Request Tracker ) website is the default bug/issue
105 tracking system for CPAN.
106
107 <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Data-Split>
108
109 • CPANTS
110
111 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
112 of a distribution.
113
114 <http://cpants.cpanauthors.org/dist/Test-Data-Split>
115
116 • CPAN Testers
117
118 The CPAN Testers is a network of smoke testers who run automated
119 tests on uploaded CPAN distributions.
120
121 <http://www.cpantesters.org/distro/T/Test-Data-Split>
122
123 • CPAN Testers Matrix
124
125 The CPAN Testers Matrix is a website that provides a visual
126 overview of the test results for a distribution on various
127 Perls/platforms.
128
129 <http://matrix.cpantesters.org/?dist=Test-Data-Split>
130
131 • CPAN Testers Dependencies
132
133 The CPAN Testers Dependencies is a website that shows a chart of
134 the test results of all dependencies for a distribution.
135
136 <http://deps.cpantesters.org/?module=Test::Data::Split>
137
138 Bugs / Feature Requests
139 Please report any bugs or feature requests by email to
140 "bug-test-data-split at rt.cpan.org", or through the web interface at
141 <https://rt.cpan.org/Public/Bug/Report.html?Queue=Test-Data-Split>. You
142 will be automatically notified of any progress on the request by the
143 system.
144
145 Source Code
146 The code is open to the world, and available for you to hack on. Please
147 feel free to browse it and play with it, or whatever. If you want to
148 contribute patches, please send me a diff or prod me to pull from your
149 repository :)
150
151 <https://github.com/shlomif/perl-Test-Data-Split>
152
153 git clone git://github.com/shlomif/perl-Test-Data-Split.git
154
156 Shlomi Fish <shlomif@cpan.org>
157
159 Please report any bugs or feature requests on the bugtracker website
160 <https://github.com/shlomif/perl-Test-Data-Split/issues>
161
162 When submitting a bug or request, please include a test-file or a patch
163 to an existing test-file that illustrates the bug or desired feature.
164
166 This software is Copyright (c) 2014 by Shlomi Fish.
167
168 This is free software, licensed under:
169
170 The MIT (X11) License
171
172
173
174perl v5.34.0 2021-07-23 Test::Data::Split(3)