1 <%-- 2 ~ Copyright (c) 2017 Google Inc. All Rights Reserved. 3 ~ 4 ~ Licensed under the Apache License, Version 2.0 (the "License"); you 5 ~ may not use this file except in compliance with the License. You may 6 ~ obtain a copy of the License at 7 ~ 8 ~ http://www.apache.org/licenses/LICENSE-2.0 9 ~ 10 ~ Unless required by applicable law or agreed to in writing, software 11 ~ distributed under the License is distributed on an "AS IS" BASIS, 12 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 ~ implied. See the License for the specific language governing 14 ~ permissions and limitations under the License. 15 --%> 16 <%@ page contentType='text/html;charset=UTF-8' language='java' %> 17 <%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions' %> 18 <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%> 19 20 <html> 21 <%@ include file="header.jsp" %> 22 <link type='text/css' href='/css/show_test_runs_common.css' rel='stylesheet'> 23 <link type='text/css' href='/css/test_results.css' rel='stylesheet'> 24 <script type='text/javascript' src='https://www.gstatic.com/charts/loader.js'></script> 25 <script src='https://www.gstatic.com/external_hosted/moment/min/moment-with-locales.min.js'></script> 26 <script src='js/time.js'></script> 27 <script src='js/test_results.js'></script> 28 <script type='text/javascript'> 29 google.charts.load('current', {'packages':['table', 'corechart']}); 30 google.charts.setOnLoadCallback(drawPieChart); 31 32 $(document).ready(function() { 33 $('#test-results-container').showTests(${testRuns}, true); 34 drawSummary(); 35 }); 36 37 // to draw pie chart 38 function drawPieChart() { 39 var topBuildResultCounts = ${topBuildResultCounts}; 40 if (topBuildResultCounts.length < 1) { 41 return; 42 } 43 var resultNames = ${resultNamesJson}; 44 var rows = resultNames.map(function(res, i) { 45 nickname = res.replace('TEST_CASE_RESULT_', '').replace('_', ' ') 46 .trim().toLowerCase(); 47 return [nickname, parseInt(topBuildResultCounts[i])]; 48 }); 49 rows.unshift(['Result', 'Count']); 50 51 // Get CSS color definitions (or default to white) 52 var colors = resultNames.map(function(res) { 53 return $('.' + res).css('background-color') || 'white'; 54 }); 55 56 var data = google.visualization.arrayToDataTable(rows); 57 var options = { 58 is3D: false, 59 colors: colors, 60 fontName: 'Roboto', 61 fontSize: '14px', 62 legend: {position: 'bottom'}, 63 tooltip: {showColorCode: true, ignoreBounds: false}, 64 chartArea: {height: '80%', width: '90%'}, 65 pieHole: 0.4 66 }; 67 68 var chart = new google.visualization.PieChart(document.getElementById('pie-chart-div')); 69 chart.draw(data, options); 70 } 71 72 // Draw a test plan run summary box. 73 function drawSummary() { 74 var testBuildId = ${testBuildId}; 75 var startTime = ${startTime}; 76 var endTime = ${endTime}; 77 var moduleCount = ${moduleCount}; 78 var passingTestCaseCount = ${passingTestCaseCount}; 79 var failingTestCaseCount = ${failingTestCaseCount}; 80 var div = $('<div></div>'); 81 var details = $('<span></span>').appendTo(div); 82 details.append('<b>VTS Build: </b>' + testBuildId + '<br>'); 83 details.append('<b>Start Time: </b>' + moment().renderTime(startTime, true) + '<br>'); 84 details.append('<b>End Time: </b>' + moment().renderTime(endTime, true) + '<br>'); 85 details.append('<b>Duration: </b>' + moment().renderDuration(endTime - startTime) + '<br>'); 86 details.append('<b>Modules: </b>' + moduleCount + '<br>'); 87 details.append('<b>Passing Test Cases: </b>' + passingTestCaseCount + '<br>'); 88 details.append('<b>Non-Passing Test Cases: </b>' + failingTestCaseCount + '<br>'); 89 div.appendTo($('#summary-container')); 90 } 91 </script> 92 93 <body> 94 <div class='wide container'> 95 <div class='row'> 96 <div class='col s7'> 97 <div class='col s12 card center-align'> 98 <div id='legend-wrapper'> 99 <c:forEach items='${resultNames}' var='res'> 100 <div class='center-align legend-entry'> 101 <c:set var='trimmed' value='${fn:replace(res, "TEST_CASE_RESULT_", "")}'/> 102 <c:set var='nickname' value='${fn:replace(trimmed, "_", " ")}'/> 103 <label for='${res}'>${nickname}</label> 104 <div id='${res}' class='${res} legend-bubble'></div> 105 </div> 106 </c:forEach> 107 </div> 108 </div> 109 <div id='summary-container' class='col s12 card'> 110 <span class='summary-header valign-wrapper'> 111 <i class='material-icons'>info_outline</i>Run Details 112 </span> 113 </div> 114 </div> 115 <div class='col s5 valign-wrapper'> 116 <!-- pie chart --> 117 <div id='pie-chart-wrapper' class='col s12 valign center-align card'> 118 <div id='pie-chart-div'></div> 119 </div> 120 </div> 121 </div> 122 123 <div class='col s12' id='test-results-container'> 124 </div> 125 </div> 126 <%@ include file="footer.jsp" %> 127 </body> 128 </html> 129