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.1
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 version 0.2.1
63
65 my $obj = Test::Data::Split->new({ %PARAMS })
66 Accepts the following parameters:
67
68 · target_dir
69
70 The path to the target directory - a string.
71
72 · filename_cb
73
74 A subroutine references that accepts "($self, {id => $id })" and
75 returns the filename.
76
77 · contents_cb
78
79 A subroutine references that accepts "($self, {id => $id, data =>
80 $data })" and returns the contents inside the file.
81
82 · data_obj
83
84 An object reference that implements the "->list_ids()" methods that
85 returns an array reference of IDs to generate as files.
86
87 An example for using it can be found in the synopsis.
88
89 $self->run()
90 Generate the files.
91
93 Shlomi Fish <shlomif@cpan.org>
94
96 This software is Copyright (c) 2014 by Shlomi Fish.
97
98 This is free software, licensed under:
99
100 The MIT (X11) License
101
103 Please report any bugs or feature requests on the bugtracker website
104 <https://github.com/shlomif/perl-Test-Data-Split/issues>
105
106 When submitting a bug or request, please include a test-file or a patch
107 to an existing test-file that illustrates the bug or desired feature.
108
110 Perldoc
111 You can find documentation for this module with the perldoc command.
112
113 perldoc Test::Data::Split
114
115 Websites
116 The following websites have more information about this module, and may
117 be of help to you. As always, in addition to those websites please use
118 your favorite search engine to discover more resources.
119
120 · MetaCPAN
121
122 A modern, open-source CPAN search engine, useful to view POD in
123 HTML format.
124
125 <https://metacpan.org/release/Test-Data-Split>
126
127 · Search CPAN
128
129 The default CPAN search engine, useful to view POD in HTML format.
130
131 <http://search.cpan.org/dist/Test-Data-Split>
132
133 · RT: CPAN's Bug Tracker
134
135 The RT ( Request Tracker ) website is the default bug/issue
136 tracking system for CPAN.
137
138 <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Data-Split>
139
140 · AnnoCPAN
141
142 The AnnoCPAN is a website that allows community annotations of Perl
143 module documentation.
144
145 <http://annocpan.org/dist/Test-Data-Split>
146
147 · CPAN Ratings
148
149 The CPAN Ratings is a website that allows community ratings and
150 reviews of Perl modules.
151
152 <http://cpanratings.perl.org/d/Test-Data-Split>
153
154 · CPANTS
155
156 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
157 of a distribution.
158
159 <http://cpants.cpanauthors.org/dist/Test-Data-Split>
160
161 · CPAN Testers
162
163 The CPAN Testers is a network of smoke testers who run automated
164 tests on uploaded CPAN distributions.
165
166 <http://www.cpantesters.org/distro/T/Test-Data-Split>
167
168 · CPAN Testers Matrix
169
170 The CPAN Testers Matrix is a website that provides a visual
171 overview of the test results for a distribution on various
172 Perls/platforms.
173
174 <http://matrix.cpantesters.org/?dist=Test-Data-Split>
175
176 · CPAN Testers Dependencies
177
178 The CPAN Testers Dependencies is a website that shows a chart of
179 the test results of all dependencies for a distribution.
180
181 <http://deps.cpantesters.org/?module=Test::Data::Split>
182
183 Bugs / Feature Requests
184 Please report any bugs or feature requests by email to
185 "bug-test-data-split at rt.cpan.org", or through the web interface at
186 <https://rt.cpan.org/Public/Bug/Report.html?Queue=Test-Data-Split>. You
187 will be automatically notified of any progress on the request by the
188 system.
189
190 Source Code
191 The code is open to the world, and available for you to hack on. Please
192 feel free to browse it and play with it, or whatever. If you want to
193 contribute patches, please send me a diff or prod me to pull from your
194 repository :)
195
196 <https://github.com/shlomif/perl-Test-Data-Split>
197
198 git clone git://github.com/shlomif/perl-Test-Data-Split.git
199
200
201
202perl v5.30.1 2020-01-30 Test::Data::Split(3)