Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 library summary_report; | |
|
ricow1
2015/01/13 07:47:13
add copyright header
kevmoo
2015/01/13 17:46:42
Done.
| |
| 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 bogus => _nonStandardTestCases.length; | |
| 24 | |
| 25 final List<TestCase> _nonStandardTestCases = <TestCase>[]; | |
| 26 | |
| 27 void add(TestCase testCase) { | |
| 28 var expectations = testCase.expectedOutcomes; | |
| 29 | |
| 30 bool containsFail = expectations | |
| 31 .any((expectation) => expectation.canBeOutcomeOf(Expectation.FAIL)); | |
| 32 bool containsPass = expectations.contains(Expectation.PASS); | |
| 33 bool containsSkip = expectations.contains(Expectation.SKIP); | |
| 34 bool containsSkipByDesign = | |
| 35 expectations.contains(Expectation.SKIP_BY_DESIGN); | |
| 36 bool containsCrash = expectations.contains(Expectation.CRASH); | |
| 37 bool containsOK = expectations.contains(Expectation.OK); | |
| 38 bool containsSlow = expectations.contains(Expectation.SLOW); | |
| 39 bool containsTimeout = expectations.contains(Expectation.TIMEOUT); | |
| 40 | |
| 41 ++_total; | |
| 42 if (containsSkip) { | |
| 43 ++_skipped; | |
| 44 } else if (containsSkipByDesign) { | |
| 45 ++_skipped; | |
| 46 ++_skippedByDesign; | |
| 47 } else { | |
| 48 // We don't do if-else below because the buckets should be exclusive. | |
| 49 // We keep a count around to guarantee that | |
| 50 int markers = 0; | |
| 51 | |
| 52 // Counts the number of flaky tests. | |
| 53 if (containsFail && containsPass && !containsCrash && !containsOK) { | |
| 54 ++_noCrash; | |
| 55 ++markers; | |
| 56 } | |
| 57 if (containsCrash && !containsOK && expectations.length > 1) { | |
| 58 ++_flakyCrash; | |
| 59 ++markers; | |
| 60 } | |
| 61 if ((containsPass && expectations.length == 1) || | |
| 62 (containsPass && containsSlow && expectations.length == 2)) { | |
| 63 ++_pass; | |
| 64 ++markers; | |
| 65 } | |
| 66 if (containsFail && containsOK) { | |
| 67 ++_failOk; | |
| 68 ++markers; | |
| 69 } | |
| 70 if ((containsFail && expectations.length == 1) || | |
| 71 (containsFail && containsSlow && expectations.length == 2)) { | |
| 72 ++_fail; | |
| 73 ++markers; | |
| 74 } | |
| 75 if ((containsCrash && expectations.length == 1) || | |
| 76 (containsCrash && containsSlow && expectations.length == 2)) { | |
| 77 ++_crash; | |
| 78 ++markers; | |
| 79 } | |
| 80 if (containsTimeout && expectations.length == 1) { | |
| 81 ++_timeout; | |
| 82 ++markers; | |
| 83 } | |
| 84 if (markers != 1) { | |
| 85 _nonStandardTestCases.add(testCase); | |
|
ricow1
2015/01/13 07:47:13
I will add another flag to the testing scripts to
kevmoo
2015/01/13 17:46:42
Acknowledged.
| |
| 86 } | |
| 87 } | |
| 88 } | |
| 89 | |
| 90 void addCompileErrorSkipTest() { | |
| 91 _total++; | |
| 92 _compileErrorSkip++; | |
| 93 } | |
| 94 | |
| 95 Map<String, int> get values => { | |
| 96 'skipped': _skipped, | |
| 97 'skippedByDesign': _skippedByDesign, | |
| 98 'pass': _pass, | |
| 99 'noCrash': _noCrash, | |
| 100 'flakyCrash': _flakyCrash, | |
| 101 'failOk': _failOk, | |
| 102 'fail': _fail, | |
| 103 'crash': _crash, | |
| 104 'timeout': _timeout, | |
| 105 'compileErrorSkip': _compileErrorSkip, | |
| 106 'bogus': bogus | |
| 107 }; | |
| 108 | |
| 109 String get report => """Total: $_total tests | |
| 110 * $_skipped tests will be skipped ($_skippedByDesign skipped by design) | |
| 111 * $_noCrash tests are expected to be flaky but not crash | |
| 112 * $_flakyCrash tests are expected to flaky crash | |
| 113 * $_pass tests are expected to pass | |
| 114 * $_failOk tests are expected to fail that we won't fix | |
| 115 * $_fail tests are expected to fail that we should fix | |
| 116 * $_crash tests are expected to crash that we should fix | |
| 117 * $_timeout tests are allowed to timeout | |
| 118 * $_compileErrorSkip tests are skipped on browsers due to compile-time error | |
| 119 * $bogus could not be categorized or are in multiple categories | |
| 120 """; | |
| 121 | |
| 122 void printReport() { | |
| 123 if (_total == 0) return; | |
| 124 print(report); | |
| 125 } | |
| 126 } | |
| OLD | NEW |