1Test::Stream::Plugin::SURsaenrd(C3o)ntributed Perl DocumTeenstta:t:iSotnream::Plugin::SRand(3)
2
3
4
6 Test::Stream::Plugin::SRand - Control the random seed for more
7 controlled test environments.
8
10 This distribution is deprecated in favor of Test2, Test2::Suite, and
11 Test2::Workflow.
12
13 See Test::Stream::Manual::ToTest2 for a conversion guide.
14
16 This module gives you control over the random seed used for your unit
17 tests. In some testing environments the random seed can play a major
18 role in results.
19
20 The default configuration for this module will seed srand with the
21 local date. Using the date as the seed means that on any given day the
22 random seed will always be the same, this means behavior will not
23 change from run to run on a given day. However the seed is different on
24 different days allowing you to be sure the code still works with actual
25 randomness.
26
27 The seed is printed for you on failure, or when the harness is verbose.
28 You can use the "TS_RAND_SEED" environment variable to specify the
29 seed. You can also provide a specific seed as a load-time argument to
30 the plugin.
31
33 Loading the plugin is easy, and the defaults are sane:
34
35 use Test::Stream 'SRand';
36
37 Custom seed:
38
39 use Test::Stream SRand => ['42'];
40
42 If you use this plugin you probably want to use it as the first, or
43 near-first plugin. "srand" is not called until the plugin is loaded, so
44 other plugins loaded first may already be making use of random numbers
45 before your seed takes effect.
46
48 The source code repository for Test::Stream can be found at
49 http://github.com/Test-More/Test-Stream/.
50
52 Chad Granum <exodist@cpan.org>
53
55 Chad Granum <exodist@cpan.org>
56
58 Copyright 2015 Chad Granum <exodist7@gmail.com>.
59
60 This program is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
63 See http://dev.perl.org/licenses/
64
65
66
67perl v5.36.0 2022-07-22 Test::Stream::Plugin::SRand(3)