Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: tools/testing/dart/test_progress.dart

Issue 8771007: tools/test.dart: Add summary report of the number of tests with each expectation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Upload report Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("test_progress"); 5 #library("test_progress");
6 6
7 #import("test_runner.dart"); 7 #import("test_runner.dart");
8 #import("test_suite.dart");
8 9
9 class ProgressIndicator { 10 class ProgressIndicator {
10 ProgressIndicator(this._startTime); 11 ProgressIndicator(this._startTime);
11 12
12 factory ProgressIndicator.fromName(String name, Date startTime) { 13 factory ProgressIndicator.fromName(String name, Date startTime) {
13 switch (name) { 14 switch (name) {
14 case 'compact': 15 case 'compact':
15 return new CompactProgressIndicator(startTime); 16 return new CompactProgressIndicator(startTime);
16 case 'line': 17 case 'line':
17 return new LineProgressIndicator(startTime); 18 return new LineProgressIndicator(startTime);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 int _passedTests = 0; 113 int _passedTests = 0;
113 int _failedTests = 0; 114 int _failedTests = 0;
114 Date _startTime; 115 Date _startTime;
115 } 116 }
116 117
117 118
118 class CompactProgressIndicator extends ProgressIndicator { 119 class CompactProgressIndicator extends ProgressIndicator {
119 CompactProgressIndicator(Date startTime) : super(startTime); 120 CompactProgressIndicator(Date startTime) : super(startTime);
120 121
121 void allDone() { 122 void allDone() {
123 SummaryReport.printReport();
122 stdout.write('\n'.charCodes()); 124 stdout.write('\n'.charCodes());
123 stdout.close(); 125 stdout.close();
124 } 126 }
125 127
126 void _printProgress() { 128 void _printProgress() {
127 var percent = ((_completedTests() / _foundTests) * 100).floor().toString(); 129 var percent = ((_completedTests() / _foundTests) * 100).floor().toString();
128 var percentPadded = _pad(percent, 5); 130 var percentPadded = _pad(percent, 5);
129 var passedPadded = _pad(_passedTests.toString(), 5); 131 var passedPadded = _pad(_passedTests.toString(), 5);
130 var failedPadded = _pad(_failedTests.toString(), 5); 132 var failedPadded = _pad(_failedTests.toString(), 5);
131 var progressLine = 133 var progressLine =
132 '\r[${_timeString()} | $percentPadded% | ' + 134 '\r[${_timeString()} | $percentPadded% | ' +
133 '+$passedPadded | -$failedPadded]'; 135 '+$passedPadded | -$failedPadded]';
134 stdout.write(progressLine.charCodes()); 136 stdout.write(progressLine.charCodes());
135 } 137 }
136 138
137 void _printStartProgress(TestCase test) => _printProgress(); 139 void _printStartProgress(TestCase test) => _printProgress();
138 void _printDoneProgress(TestCase test) => _printProgress(); 140 void _printDoneProgress(TestCase test) => _printProgress();
139 } 141 }
140 142
141 143
142 class LineProgressIndicator extends ProgressIndicator { 144 class LineProgressIndicator extends ProgressIndicator {
143 LineProgressIndicator(Date startTime) : super(startTime); 145 LineProgressIndicator(Date startTime) : super(startTime);
144 146
145 void allDone() { 147 void allDone() {
146 _printStatus(); 148 _printStatus();
149 SummaryReport.printReport();
147 } 150 }
148 151
149 void _printStartProgress(TestCase test) { 152 void _printStartProgress(TestCase test) {
150 } 153 }
151 154
152 void _printDoneProgress(TestCase test) { 155 void _printDoneProgress(TestCase test) {
153 var status = 'pass'; 156 var status = 'pass';
154 if (test.output.unexpectedOutput) { 157 if (test.output.unexpectedOutput) {
155 status = 'fail'; 158 status = 'fail';
156 } 159 }
157 print('Done ${test.displayName}: $status'); 160 print('Done ${test.displayName}: $status');
158 } 161 }
159 } 162 }
160 163
161 164
162 class VerboseProgressIndicator extends ProgressIndicator { 165 class VerboseProgressIndicator extends ProgressIndicator {
163 VerboseProgressIndicator(Date startTime) : super(startTime); 166 VerboseProgressIndicator(Date startTime) : super(startTime);
164 167
165 void allDone() { 168 void allDone() {
166 _printStatus(); 169 _printStatus();
170 SummaryReport.printReport();
167 } 171 }
168 172
169 void _printStartProgress(TestCase test) { 173 void _printStartProgress(TestCase test) {
170 print('Starting ${test.displayName}...'); 174 print('Starting ${test.displayName}...');
171 } 175 }
172 176
173 void _printDoneProgress(TestCase test) { 177 void _printDoneProgress(TestCase test) {
174 var status = 'pass'; 178 var status = 'pass';
175 if (test.output.unexpectedOutput) { 179 if (test.output.unexpectedOutput) {
176 status = 'fail'; 180 status = 'fail';
177 } 181 }
178 print('Done ${test.displayName}: $status'); 182 print('Done ${test.displayName}: $status');
179 } 183 }
180 } 184 }
181 185
182 186
183 class StatusProgressIndicator extends ProgressIndicator { 187 class StatusProgressIndicator extends ProgressIndicator {
184 StatusProgressIndicator(Date startTime) : super(startTime); 188 StatusProgressIndicator(Date startTime) : super(startTime);
185 189
186 void allDone() { 190 void allDone() {
187 _printStatus(); 191 _printStatus();
192 SummaryReport.printReport();
188 } 193 }
189 194
190 void _printStartProgress(TestCase test) { 195 void _printStartProgress(TestCase test) {
191 } 196 }
192 197
193 void _printDoneProgress(TestCase test) { 198 void _printDoneProgress(TestCase test) {
194 } 199 }
195 } 200 }
196 201
197 202
(...skipping 11 matching lines...) Expand all
209 var status = 'pass'; 214 var status = 'pass';
210 if (test.output.unexpectedOutput) { 215 if (test.output.unexpectedOutput) {
211 status = 'fail'; 216 status = 'fail';
212 } 217 }
213 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); 218 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString();
214 print('Done ${test.displayName}: $status'); 219 print('Done ${test.displayName}: $status');
215 print('@@@STEP_CLEAR@@@'); 220 print('@@@STEP_CLEAR@@@');
216 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); 221 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@');
217 } 222 }
218 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698