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

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

Issue 847873004: Outputing comma-separated report with percentages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months 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
(Empty)
1 library summary_report;
2
3 import "status_file_parser.dart";
4 import "test_runner.dart";
5
6 final summaryReport = new SummaryReport();
7
8 class SummaryReport {
9 int _total = 0;
10 int _skipped = 0;
11 int _skippedByDesign = 0;
12 int _noCrash = 0;
13 int _flakyCrash = 0;
14 int _pass = 0;
15 int _failOk = 0;
16 int _fail = 0;
17 int _crash = 0;
18 int _timeout = 0;
19 int _compileErrorSkip = 0;
20
21 int get total => _total;
22
23 int get skippedOther => _skipped - _skippedByDesign;
24
25 int get bogus => _nonStandardTestCases.length;
26
27 final List<TestCase> _nonStandardTestCases = <TestCase>[];
28
29 void add(TestCase testCase) {
30 var expectations = testCase.expectedOutcomes;
31
32 bool containsFail = expectations
33 .any((expectation) => expectation.canBeOutcomeOf(Expectation.FAIL));
34 bool containsPass = expectations.contains(Expectation.PASS);
35 bool containsSkip = expectations.contains(Expectation.SKIP);
36 bool containsSkipByDesign =
37 expectations.contains(Expectation.SKIP_BY_DESIGN);
38 bool containsCrash = expectations.contains(Expectation.CRASH);
39 bool containsOK = expectations.contains(Expectation.OK);
40 bool containsSlow = expectations.contains(Expectation.SLOW);
41 bool containsTimeout = expectations.contains(Expectation.TIMEOUT);
42
43 ++_total;
44 if (containsSkip) {
45 ++_skipped;
46 } else if (containsSkipByDesign) {
47 ++_skipped;
48 ++_skippedByDesign;
49 } else {
50 // We don't do if-else below because the buckets should be exclusive.
51 // We keep a count around to guarantee that
52 int markers = 0;
53
54 // Counts the number of flaky tests.
55 if (containsFail && containsPass && !containsCrash && !containsOK) {
56 ++_noCrash;
57 ++markers;
58 }
59 if (containsCrash && !containsOK && expectations.length > 1) {
60 ++_flakyCrash;
61 ++markers;
62 }
63 if ((containsPass && expectations.length == 1) ||
64 (containsPass && containsSlow && expectations.length == 2)) {
65 ++_pass;
66 ++markers;
67 }
68 if (containsFail && containsOK) {
69 ++_failOk;
70 ++markers;
71 }
72 if ((containsFail && expectations.length == 1) ||
73 (containsFail && containsSlow && expectations.length == 2)) {
74 ++_fail;
75 ++markers;
76 }
77 if ((containsCrash && expectations.length == 1) ||
78 (containsCrash && containsSlow && expectations.length == 2)) {
79 ++_crash;
80 ++markers;
81 }
82 if (containsTimeout && expectations.length == 1) {
83 ++_timeout;
84 ++markers;
85 }
86 if (markers != 1) {
87 _nonStandardTestCases.add(testCase);
88 }
89 }
90 }
91
92 void addCompileErrorSkipTest() {
93 _total++;
94 _compileErrorSkip++;
95 }
96
97 Map<String, int> get values => {
98 'total': _total,
99 'skippedOther': skippedOther,
100 'skippedByDesign': _skippedByDesign,
101 'pass': _pass,
102 'noCrash': _noCrash,
103 'flakyCrash': _flakyCrash,
104 'failOk': _failOk,
105 'fail': _fail,
106 'crash': _crash,
107 'timeout': _timeout,
108 'compileErrorSkip': _compileErrorSkip,
109 'bogus': bogus
110 };
111
112 String get report => """Total: $_total tests
113 * $_skipped tests will be skipped ($_skippedByDesign skipped by design)
114 * $_noCrash tests are expected to be flaky but not crash
115 * $_flakyCrash tests are expected to flaky crash
116 * $_pass tests are expected to pass
117 * $_failOk tests are expected to fail that we won't fix
118 * $_fail tests are expected to fail that we should fix
119 * $_crash tests are expected to crash that we should fix
120 * $_timeout tests are allowed to timeout
121 * $_compileErrorSkip tests are skipped on browsers due to compile-time error
122 * $bogus could not be categorized or are in multiple categories
123 """;
124
125 void printReport() {
126 if (_total == 0) return;
127 print(report);
128 }
129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698