File: api-ahven-listeners.rst

package info (click to toggle)
ahven 2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,724 kB
  • sloc: ada: 3,928; makefile: 259; xml: 108; sh: 57; python: 25; perl: 7
file content (119 lines) | stat: -rw-r--r-- 2,282 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
:mod:`Ahven.Listeners` -- Package
=================================

.. module:: Ahven.Listeners
.. moduleauthor:: Tero Koskinen <tero.koskinen@iki.fi>


-----
Types
-----

Test_Phase
''''''''''

::

   type Test_Phase is (TEST_BEGIN, TEST_RUN, TEST_END);

What is test doing right now?

Test_Type
'''''''''

::

   type Test_Type is (CONTAINER, ROUTINE);

Context
'''''''

::

   type Context (Phase : Test_Phase) is record
      Test_Name : AStrings.Bounded_String;
      Test_Kind : Test_Type;
      case Phase is
         when TEST_BEGIN | TEST_END =>
            null;
         when TEST_RUN =>
            Routine_Name : AStrings.Bounded_String;
            Message      : AStrings.Bounded_String;
            Long_Message : AStrings.Bounded_String;
      end case;
   end record;

Result_Listener
'''''''''''''''

::

   type Result_Listener is
     abstract new Ada.Finalization.Limited_Controlled with null record;

Result_Listener is a listener for test results.
Whenever a test is run, the framework calls
registered listeners and tells them the result of the test.

Result_Listener_Class_Access
''''''''''''''''''''''''''''

::

   type Result_Listener_Class_Access is access all Result_Listener'Class;


------------------------
Procedures and Functions
------------------------

Add_Pass
''''''''

::

   procedure Add_Pass (Listener : in out Result_Listener;
                       Info     :        Context) is abstract;

Called after test passes.

Add_Failure
'''''''''''

::

   procedure Add_Failure (Listener : in out Result_Listener;
                          Info     :        Context) is abstract;

Called after test fails.

Add_Error
'''''''''

::

   procedure Add_Error (Listener : in out Result_Listener;
                        Info     :        Context) is abstract;

Called after there is an error in the test.

Start_Test
''''''''''

::

   procedure Start_Test (Listener : in out Result_Listener;
                         Info     :        Context) is abstract;

Called before the test begins. This is called before Add_* procedures.

End_Test
''''''''

::

   procedure End_Test (Listener : in out Result_Listener;
                       Info     :        Context) is abstract;

Called after the test ends. Add_* procedures are called before this.