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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
unit GuiTestRunner;
{$mode objfpc}{$H+}
interface
uses
SysUtils, Classes,
// fpGUI toolkit
gfxbase, fpgfx, gui_edit, gfx_widget, gui_form, gui_label, gui_button,
gui_listbox, gui_memo, gui_combobox, gui_basegrid, gui_grid,
gui_dialogs, gui_checkbox, gui_tree, gui_trackbar, gui_progressbar,
gui_radiobutton, gui_tab, gui_menu, gui_panel, gui_popupcalendar,
gui_gauge,
// FPCUnit support
fpcunit, testregistry;
type
TGUITestRunnerForm = class(TfpgForm, ITestListener)
private
failureCounter: Integer;
errorCounter: Integer;
testsCounter: Integer;
skipsCounter: Integer;
// ITestListener
procedure AddFailure(ATest: TTest; AFailure: TTestFailure);
procedure AddError(ATest: TTest; AError: TTestFailure);
procedure StartTest(ATest: TTest);
procedure EndTest(ATest: TTest);
procedure StartTestSuite(ATestSuite: TTestSuite);
procedure EndTestSuite(ATestSuite: TTestSuite);
//
procedure MemoLog(LogEntry: string);
public
{@VFD_HEAD_BEGIN: GUITestRunnerForm}
pbName1: TfpgProgressBar;
cbName1: TfpgComboBox;
btnRun: TfpgButton;
lblName1: TfpgLabel;
memName1: TfpgMemo;
btnClear: TfpgButton;
btnQuit: TfpgButton;
lblName2: TfpgLabel;
lblRuns: TfpgLabel;
lblName4: TfpgLabel;
lblErrors: TfpgLabel;
lblName6: TfpgLabel;
lblFailures: TfpgLabel;
{@VFD_HEAD_END: GUITestRunnerForm}
procedure AfterCreate; override;
end;
{@VFD_NEWFORM_DECL}
implementation
{@VFD_NEWFORM_IMPL}
procedure TGUITestRunnerForm.AddFailure(ATest: TTest; AFailure: TTestFailure);
begin
end;
procedure TGUITestRunnerForm.AddError(ATest: TTest; AError: TTestFailure);
begin
end;
procedure TGUITestRunnerForm.StartTest(ATest: TTest);
begin
end;
procedure TGUITestRunnerForm.EndTest(ATest: TTest);
begin
end;
procedure TGUITestRunnerForm.StartTestSuite(ATestSuite: TTestSuite);
begin
end;
procedure TGUITestRunnerForm.EndTestSuite(ATestSuite: TTestSuite);
begin
end;
procedure TGUITestRunnerForm.MemoLog(LogEntry: string);
begin
memName1.Lines.Add(TimeToStr(Now) + ' - ' + LogEntry);
end;
procedure TGUITestRunnerForm.AfterCreate;
begin
{@VFD_BODY_BEGIN: GUITestRunnerForm}
Name := 'GUITestRunnerForm';
SetPosition(304, 190, 359, 310);
WindowTitle := 'GUI Test Runner';
pbName1 := TfpgProgressBar.Create(self);
with pbName1 do
begin
Name := 'pbName1';
SetPosition(8, 64, 340, 22);
Anchors := [anLeft,anRight,anTop];
end;
cbName1 := TfpgComboBox.Create(self);
with cbName1 do
begin
Name := 'cbName1';
SetPosition(16, 24, 244, 22);
Anchors := [anLeft,anRight,anTop];
FontDesc := '#List';
TabOrder := 1;
end;
btnRun := TfpgButton.Create(self);
with btnRun do
begin
Name := 'btnRun';
SetPosition(268, 24, 80, 24);
Anchors := [anRight,anTop];
Text := 'Run';
FontDesc := '#Label1';
ImageName := '';
TabOrder := 2;
end;
lblName1 := TfpgLabel.Create(self);
with lblName1 do
begin
Name := 'lblName1';
SetPosition(4, 4, 236, 16);
FontDesc := '#Label2';
Text := 'TestCase';
end;
memName1 := TfpgMemo.Create(self);
with memName1 do
begin
Name := 'memName1';
SetPosition(8, 120, 340, 156);
Anchors := [anLeft,anRight,anTop,anBottom];
FontDesc := '#Edit1';
TabOrder := 4;
end;
btnClear := TfpgButton.Create(self);
with btnClear do
begin
Name := 'btnClear';
SetPosition(8, 280, 80, 24);
Anchors := [anLeft,anBottom];
Text := 'Clear';
FontDesc := '#Label1';
ImageName := '';
TabOrder := 5;
end;
btnQuit := TfpgButton.Create(self);
with btnQuit do
begin
Name := 'btnQuit';
SetPosition(268, 280, 80, 24);
Anchors := [anRight,anBottom];
Text := 'Quit';
FontDesc := '#Label1';
ImageName := '';
TabOrder := 6;
end;
lblName2 := TfpgLabel.Create(self);
with lblName2 do
begin
Name := 'lblName2';
SetPosition(8, 96, 40, 16);
FontDesc := '#Label2';
Text := 'Runs:';
end;
lblRuns := TfpgLabel.Create(self);
with lblRuns do
begin
Name := 'lblRuns';
SetPosition(52, 96, 56, 16);
FontDesc := '#Label1';
Text := '---';
end;
lblName4 := TfpgLabel.Create(self);
with lblName4 do
begin
Name := 'lblName4';
SetPosition(124, 96, 52, 16);
FontDesc := '#Label2';
Text := 'Errors:';
end;
lblErrors := TfpgLabel.Create(self);
with lblErrors do
begin
Name := 'lblErrors';
SetPosition(172, 96, 36, 16);
FontDesc := '#Label1';
Text := '---';
end;
lblName6 := TfpgLabel.Create(self);
with lblName6 do
begin
Name := 'lblName6';
SetPosition(220, 96, 60, 16);
FontDesc := '#Label2';
Text := 'Failures:';
end;
lblFailures := TfpgLabel.Create(self);
with lblFailures do
begin
Name := 'lblFailures';
SetPosition(284, 96, 48, 16);
FontDesc := '#Label1';
Text := '---';
end;
{@VFD_BODY_END: GUITestRunnerForm}
end;
end.
|