|
| 1 | +# Night Statistics Monitoring |
| 2 | + |
| 3 | +## The problem |
| 4 | +We want to develop and improve our product and, of course, |
| 5 | +there are some changes and its combinations |
| 6 | +which, according to some statistics, can make UTBot worse. |
| 7 | + |
| 8 | +## Monitoring |
| 9 | +The main idea is collecting statistics after made changes. |
| 10 | +But it takes too long to collect statistics on a huge project |
| 11 | +to do it after each push into master. |
| 12 | +Thus, we will do it every night when no one makes changes. |
| 13 | + |
| 14 | +### Collecting statistics |
| 15 | +Collecting statistics StatisticsMonitoring.kt based on ContestEstimator.kt |
| 16 | +that runs testcase generation on projects, then compile generated tests. |
| 17 | +We run it several times. Input arguments: `<output json> <run tries> <run timeout min>`. |
| 18 | +More about statistic: Statistics.kt. |
| 19 | + |
| 20 | +Example input: |
| 21 | +``` |
| 22 | +stats.json 3 20 |
| 23 | +``` |
| 24 | +Example output: |
| 25 | +```json |
| 26 | +[ |
| 27 | + { |
| 28 | + "classes_for_generation": 20, |
| 29 | + "tc_generated": 1204, |
| 30 | + "classes_without_problems": 12, |
| 31 | + "classes_canceled_by_timeout": 3, |
| 32 | + "total_methods_for_generation": 519, |
| 33 | + "methods_with_at_least_one_testcase_generated": 332, |
| 34 | + "methods_with_exceptions": 42, |
| 35 | + "suspicious_methods": 107, |
| 36 | + "test_classes_failed_to_compile": 0, |
| 37 | + "covered_instructions_count": 5282, |
| 38 | + "total_instructions_count": 10932, |
| 39 | + "avg_coverage": 57.43687433585721 |
| 40 | + }, |
| 41 | + { |
| 42 | + "classes_for_generation": 20, |
| 43 | + "tc_generated": 1692, |
| 44 | + "classes_without_problems": 12, |
| 45 | + "classes_canceled_by_timeout": 2, |
| 46 | + "total_methods_for_generation": 519, |
| 47 | + "methods_with_at_least_one_testcase_generated": 426, |
| 48 | + "methods_with_exceptions": 49, |
| 49 | + "suspicious_methods": 29, |
| 50 | + "test_classes_failed_to_compile": 1, |
| 51 | + "covered_instructions_count": 6499, |
| 52 | + "total_instructions_count": 11023, |
| 53 | + "avg_coverage": 66.33821560285908 |
| 54 | + }, |
| 55 | + { |
| 56 | + "classes_for_generation": 20, |
| 57 | + "tc_generated": 1406, |
| 58 | + "classes_without_problems": 12, |
| 59 | + "classes_canceled_by_timeout": 3, |
| 60 | + "total_methods_for_generation": 519, |
| 61 | + "methods_with_at_least_one_testcase_generated": 394, |
| 62 | + "methods_with_exceptions": 43, |
| 63 | + "suspicious_methods": 61, |
| 64 | + "test_classes_failed_to_compile": 0, |
| 65 | + "covered_instructions_count": 5851, |
| 66 | + "total_instructions_count": 11011, |
| 67 | + "avg_coverage": 60.71679400185094 |
| 68 | + } |
| 69 | +] |
| 70 | +``` |
| 71 | + |
| 72 | +### Transforming, aggregating and rendering statistics |
| 73 | +Transforming adds total coverage statistics and timestamp. |
| 74 | +After that all collected statistics are aggregated by average function. |
| 75 | +Then history updates by aggregated statistics and rendered into 2 pictures: |
| 76 | +- coverage graph - graph with coverage statistics. |
| 77 | +- quantitative graph - graph with other quantitative statistics. |
| 78 | + |
| 79 | + |
| 80 | +Script: draw_stats_graphs.py. |
| 81 | +Input arguments: `<history file> <new stats file> <output coverage graph> <output quantitative graph>`. |
| 82 | + |
| 83 | +Example input: |
| 84 | +``` |
| 85 | +monitoring/history.json stats.json monitoring/coverage_graph.png monitoring/quantitative_graph.png |
| 86 | +``` |
| 87 | +Example output: |
| 88 | +```json |
| 89 | +[ |
| 90 | + { |
| 91 | + "classes_for_generation": 20.0, |
| 92 | + "tc_generated": 1434.0, |
| 93 | + "classes_without_problems": 12.0, |
| 94 | + "classes_canceled_by_timeout": 2.6666666666666665, |
| 95 | + "total_methods_for_generation": 519.0, |
| 96 | + "methods_with_at_least_one_testcase_generated": 384.0, |
| 97 | + "methods_with_exceptions": 44.666666666666664, |
| 98 | + "suspicious_methods": 65.66666666666667, |
| 99 | + "test_classes_failed_to_compile": 0.33333333333333337, |
| 100 | + "avg_coverage": 61.49729464685574, |
| 101 | + "total_coverage": 53.47106015409328, |
| 102 | + "timestamp": 1659715928.5049753 |
| 103 | + } |
| 104 | +] |
| 105 | +``` |
0 commit comments