1Test::Unit::Result(3) User Contributed Perl DocumentationTest::Unit::Result(3)
2
3
4
6 Test::Unit::Result - unit testing framework helper class
7
9 This class is not intended to be used directly
10
12 This class is used by the framework to record the results of tests,
13 which will throw an instance of a subclass of Test::Unit::Exception in
14 case of errors or failures.
15
16 To achieve this, this class gets called with a test case as argument.
17 It will call this test case's run method back and catch any exceptions
18 thrown.
19
20 It could be argued that Test::Unit::Result is the heart of the PerlUnit
21 framework, since TestCase classes vary, and you can use one of several
22 Test::Unit::TestRunners, but we always gather the results in a
23 Test::Unit::Result object.
24
25 This is the quintessential call tree of the communication needed to
26 record the results of a given test:
27
28 $aTestCase->run() {
29 # creates result
30 $aTestResult->run($aTestCase) {
31 # catches exception and records it
32 $aTestCase->run_bare() {
33 # runs test method inside eval
34 $aTestCase->run_test() {
35 # calls method $aTestCase->name()
36 # and propagates exception
37 # method will call Assert::assert()
38 # to cause failure if test fails on
39 # test assertion
40 # it finds this because $aTestCase is-a Assert
41 }
42 }
43 }
44 }
45
46 Note too that, in the presence of Test::Unit::TestSuites, this call
47 tree can get a little more convoluted, but if you bear the above in
48 mind it should be apparent what's going on.
49
51 Copyright (c) 2000-2002, 2005 the PerlUnit Development Team (see
52 Test::Unit or the AUTHORS file included in this distribution).
53
54 All rights reserved. This program is free software; you can
55 redistribute it and/or modify it under the same terms as Perl itself.
56
58 • Test::Unit::Assert
59
60 • Test::Unit::TestCase
61
62 • Test::Unit::Exception
63
64
65
66perl v5.34.0 2021-07-23 Test::Unit::Result(3)