1Test::Roo::Class(3) User Contributed Perl Documentation Test::Roo::Class(3)
2
3
4
6 Test::Roo::Class - Base class for Test::Roo test classes
7
9 version 1.004
10
12 This module is the base class for Test::Roo test classes. It provides
13 methods to run tests and anchor modifiers. Generally, you should not
14 extend this class yourself, but use Test::Roo to do so instead.
15
17 description
18 A description for a subtest block wrapping all tests by the object. It
19 is a 'lazy' attribute. Test classes may implement their own
20 "_build_description" method to create a description from object
21 attributes. Otherwise, the default is "testing with CLASS".
22
24 run_tests
25 # as a class method
26 $class->run_tests();
27 $class->run_tests($description);
28 $class->run_tests($init_args);
29 $class->run_tests($description $init_args);
30
31 # as an object method
32 $self->run_tests();
33 $self->run_tests($description);
34
35 If called as a class method, this creates a test object using an
36 optional hash reference of initialization arguments.
37
38 When called as an object method, or after an object has been generated,
39 this method sets an optional description and runs tests. It will call
40 the "setup" method (triggering any method modifiers), will run all
41 tests (triggering any method modifiers on "each_test") and will call
42 the "teardown" method (triggering any method modifiers).
43
44 If a description is provided, it will override any initialized or
45 generated "description" attribute.
46
47 The setup, tests and teardown will be executed in a Test::More subtest
48 block.
49
50 setup
51 This is an empty method used to anchor method modifiers. It should not
52 be overridden by subclasses.
53
54 each_test
55 This method wraps the code references set by the "test" function from
56 Test::Roo or Test::Roo::Role in a Test::More subtest block.
57
58 It may also be used to anchor modifiers that should run before or after
59 each test block, though this can lead to brittle design as modifiers
60 will globally affect every test block, including composed ones.
61
62 teardown
63 This is an empty method used to anchor method modifiers. It should not
64 be overridden by subclasses.
65
67 David Golden <dagolden@cpan.org>
68
70 This software is Copyright (c) 2013 by David Golden.
71
72 This is free software, licensed under:
73
74 The Apache License, Version 2.0, January 2004
75
76
77
78perl v5.38.0 2023-07-21 Test::Roo::Class(3)