diff options
Diffstat (limited to 'non-puppet/qtmetrics2/templates/testset.html')
-rw-r--r-- | non-puppet/qtmetrics2/templates/testset.html | 464 |
1 files changed, 239 insertions, 225 deletions
diff --git a/non-puppet/qtmetrics2/templates/testset.html b/non-puppet/qtmetrics2/templates/testset.html index 59f98e4..9df501c 100644 --- a/non-puppet/qtmetrics2/templates/testset.html +++ b/non-puppet/qtmetrics2/templates/testset.html @@ -34,8 +34,8 @@ /** * Testset page - * @version 0.4 - * @since 26-06-2015 + * @version 0.5 + * @since 30-06-2015 * @author Juha Sippola */ @@ -70,6 +70,12 @@ <div class="col-sm-12 col-md-12 main"> + {# Check if any runs available #} + {% set runsAvailable = 0 %} + {% for run in testsetRuns %} + {% set runsAvailable = 1 %} + {% endfor %} + {##### Title #####} <h1 class="page-header"> @@ -97,256 +103,264 @@ (during the last {{ lastDaysFlaky }} days, since {{ sinceDateFlaky }}).</li> <li><strong>Results in Branches</strong> shows the {{ testset.getName }} run results by branch and their configuration on <strong>{{ masterProject }} {{ masterState }}</strong> builds - (<span class="glyphicon glyphicon-ok green"></span> = passed, - <span class="glyphicon glyphicon-ok-sign green"></span> = passed as flaky, - <span class="glyphicon glyphicon-remove red"></span> = failed); details on the runs are - available as tooltip on result icon.</li> + (<span class="glyphicon glyphicon-ok green"></span> = {{ constant('TestsetRun::RESULT_SUCCESS') }}, + <span class="glyphicon glyphicon-ok-sign green"></span> = {{ constant('TestsetRun::RESULT_SUCCESS') }} as flaky, + <span class="glyphicon glyphicon-remove red"></span> = {{ constant('TestsetRun::RESULT_FAILURE') }}); + details on the runs are available as tooltip on result icon.</li> </ul> </div> </div> - {##### Summary #####} - - <div class="panel panel-primary"> - <div class="panel-heading"> - <h4 class="panel-title bold">Summary</h4> - </div> - <div class="panel-body"> - <div class="table-responsive"> - <table class="table table-striped"> - <thead> - <tr> - <th>project</th> - <th>latest result</th> - <th class="leftBorder center"><span class="spaceHorizontal glyphicon glyphicon-remove red"></span>failed <span class ="gray">(total)</span></th> - <th class="showInLargeDisplay"></th> - <th class="leftBorder center"><span class="spaceHorizontal glyphicon glyphicon-ok-sign green"></span>flaky <span class ="gray">(total)</span></th> - <th class="showInLargeDisplay"></th> - </tr> - </thead> - <tbody> - {# Calculate max result count for the bar #} - {% set maxCount = 1 %} - {% if (testset.getTestsetResultCounts.passed + testset.getTestsetResultCounts.failed) > maxCount %} - {% set maxCount = testset.getTestsetResultCounts.passed + testset.getTestsetResultCounts.failed %} - {% endif %} - {% if testset.getTestsetFlakyCounts.flaky > maxCount %} - {% set maxCount = testset.getTestsetFlakyCounts.flaky %} - {% endif %} - - {# Print summary #} - <tr> - {# Project name #} - <td>{{ testset.getProjectName }}</td> - - {# Testset status according to the latest build results #} - {% if testset.getStatus == constant('testsetRun::RESULT_SUCCESS') %} - {% set resultIcon = 'glyphicon glyphicon-ok green' %} - {% elseif testset.getStatus == constant('testsetRun::RESULT_FAILURE') %} - {% set resultIcon = 'glyphicon glyphicon-remove red' %} - {% else %} - {% set resultIcon = '' %} - {% endif %} - <td><span class="spaceHorizontal {{ resultIcon }}"></span>{{ testset.getStatus }}</td> - - {# Show failed #} - {% set failed = testset.getTestsetResultCounts.failed %} - {% set passed = testset.getTestsetResultCounts.passed %} - {% set total = passed + failed %} - <td class="leftBorder center">{{ failed }}<span class ="gray"> ({{ total }})</span></td> - {# Show results as bars (scaled to BAR_AREA px) #} - {% set passedBar = ((BAR_AREA/maxCount) * passed)|round(0, 'floor') %} - {% if (passed > 0) and (passedBar == 0) %} - {% set passedBar = 1 %} - {% endif %} - {% set failedBar = ((BAR_AREA/maxCount)*failed)|round(0, 'floor') %} - {% if (failed > 0) and (failedBar == 0) %} - {% set failedBar = 1 %} + {% if runsAvailable %} + + {##### Latest Status #####} + + <div class="panel panel-primary"> + <div class="panel-heading"> + <h4 class="panel-title bold">Latest Status</h4> + </div> + <div class="panel-body"> + <div class="table-responsive"> + <table class="table table-striped"> + <thead> + <tr> + <th>project</th> + <th>latest result</th> + <th class="leftBorder center"><span class="spaceHorizontal glyphicon glyphicon-remove red"></span>failed <span class ="gray">(total)</span></th> + <th class="showInLargeDisplay"></th> + <th class="leftBorder center"><span class="spaceHorizontal glyphicon glyphicon-ok-sign green"></span>flaky <span class ="gray">(total)</span></th> + <th class="showInLargeDisplay"></th> + </tr> + </thead> + <tbody> + {# Calculate max result count for the bar #} + {% set maxCount = 1 %} + {% if (testset.getTestsetResultCounts.passed + testset.getTestsetResultCounts.failed) > maxCount %} + {% set maxCount = testset.getTestsetResultCounts.passed + testset.getTestsetResultCounts.failed %} {% endif %} - <td class="center showInLargeDisplay"> - <div> - <div class="floatLeft redBackground" style="width: {{ failedBar }}px">{{ failed }}</div> - <div class="floatLeft greenBackground" style="width: {{ passedBar }}px">{{ passed }}</div> - </div> - </td> - - {# Show flaky #} - {% set flaky = testset.getTestsetFlakyCounts.flaky %} - <td class="leftBorder center">{{ flaky }}<span class ="gray"> ({{ total }})</span></td> - {# Show results as bars (scaled to BAR_AREA px) #} - {% set flakyBar = ((BAR_AREA/maxCount)*flaky)|round(0, 'floor') %} - {% if (flaky > 0) and (flakyBar == 0) %} - {% set flakyBar = 1 %} + {% if testset.getTestsetFlakyCounts.flaky > maxCount %} + {% set maxCount = testset.getTestsetFlakyCounts.flaky %} {% endif %} - <td class="center showInLargeDisplay"> - {% if flaky > 0 %} - <div> - <div class="floatLeft redBackground" style="width: {{ flakyBar }}px">{{ flaky }}</div> - </div> + + {# Print summary #} + <tr> + {# Project name #} + <td>{{ testset.getProjectName }}</td> + + {# Testset status according to the latest build results #} + {% if testset.getStatus == constant('TestsetRun::RESULT_SUCCESS') %} + {% set resultIcon = 'glyphicon glyphicon-ok green' %} + {% elseif testset.getStatus == constant('TestsetRun::RESULT_FAILURE') %} + {% set resultIcon = 'glyphicon glyphicon-remove red' %} + {% else %} + {% set resultIcon = '' %} + {% endif %} + <td><span class="spaceHorizontal {{ resultIcon }}"></span>{{ testset.getStatus }}</td> + + {# Show failed #} + {% set failed = testset.getTestsetResultCounts.failed %} + {% set passed = testset.getTestsetResultCounts.passed %} + {% set total = passed + failed %} + <td class="leftBorder center">{{ failed }}<span class ="gray"> ({{ total }})</span></td> + {# Show results as bars (scaled to BAR_AREA px) #} + {% set passedBar = ((BAR_AREA/maxCount) * passed)|round(0, 'floor') %} + {% if (passed > 0) and (passedBar == 0) %} + {% set passedBar = 1 %} + {% endif %} + {% set failedBar = ((BAR_AREA/maxCount)*failed)|round(0, 'floor') %} + {% if (failed > 0) and (failedBar == 0) %} + {% set failedBar = 1 %} {% endif %} - </td> - </tr> + <td class="center showInLargeDisplay"> + <div> + <div class="floatLeft redBackground" style="width: {{ failedBar }}px"><small>{{ failed }}</small></div> + <div class="floatLeft greenBackground" style="width: {{ passedBar }}px"><small>{{ passed }}</small></div> + </div> + </td> + + {# Show flaky #} + {% set flaky = testset.getTestsetFlakyCounts.flaky %} + <td class="leftBorder center">{{ flaky }}<span class ="gray"> ({{ total }})</span></td> + {# Show results as bars (scaled to BAR_AREA px) #} + {% set flakyBar = ((BAR_AREA/maxCount)*flaky)|round(0, 'floor') %} + {% if (flaky > 0) and (flakyBar == 0) %} + {% set flakyBar = 1 %} + {% endif %} + <td class="center showInLargeDisplay"> + {% if flaky > 0 %} + <div> + <div class="floatLeft redBackground" style="width: {{ flakyBar }}px"><small>{{ flaky }}</small></div> + </div> + {% endif %} + </td> + </tr> - </tbody> - </table> - </div> {# /table-responsive #} - </div> {# /panel-body #} - </div> {# /panel... #} + </tbody> + </table> + </div> {# /table-responsive #} + </div> {# /panel-body #} + </div> {# /panel... #} - {##### Results in Branches #####} + {##### Results in Branches #####} - <div class="panel panel-primary"> - <div class="panel-heading"> - <h4 class="panel-title bold">Results in Branches</h4> + <div class="panel panel-primary"> + <div class="panel-heading"> + <h4 class="panel-title bold">Results in Branches</h4> + </div> </div> - </div> - - {# Get branches #} - {% set branches = [] %} - {% for run in projectBuilds %} - {% if run.branch not in branches %} - {% set branches = branches|merge([run.branch]) %} - {% endif %} - {% endfor %} - {# Loop all the branches #} - {% for branch in branches %} - - {# Get all build keys #} - {% set buildKey = '' %} - {% set buildKeys = [] %} - {% set dates = [] %} + {# Get branches #} + {% set branches = [] %} {% for run in projectBuilds %} - {% if run.branch == branch %} - {% if buildKey != run.buildKey %} - {% set buildKey = run.buildKey %} - {% set buildKeys = buildKeys|merge([run.buildKey]) %} - {% set dates = dates|merge([run.timestamp]) %} - {% endif %} + {% if run.branch not in branches %} + {% set branches = branches|merge([run.branch]) %} {% endif %} {% endfor %} - {# Check if testset run for this branch #} - {% set testsetBranch = 0 %} - {% for run in testsetRuns if run.getBranchName == branch %} - {% set testsetBranch = 1 %} - {% endfor %} - - {# Show branch if testset run for it #} - {% if testsetBranch %} - <div class="panel panel-info"> - <div class="panel-heading"> - <h4 class="panel-title bold">{{ branch }}</h4> - </div> - <div class="panel-body"> - <div class="table-responsive"> - <table class="table table-striped"> - <thead> - <tr> - <th class="bold rightBorder">{{ testset.getName }}</th> - {% for key, buildKey in buildKeys %} - <th class="center"> - {% if buildKey|length > 6 %} - <span class="clickOnTouch" data-toggle="tooltip" data-placement="top" - title="{{ buildKey }}">{{ buildKey|slice(0, 4) }}... - </span> - {% else %} - {{ buildKey }} - {% endif %} - <br> - <span class="gray"><small>{{ dates[key]|date("m-d") }}</small></span> - </th> - {% endfor %} - </tr> - </thead> - <tbody> - {% set confPrev = '' %} - {% set buildKeyIndexPrinted = -1 %} - {% set buildKeyFound = 0 %} - {% for run in testsetRuns if run.getBranchName == branch %} - - {# New row for each conf #} - {% if confPrev != run.getConfName %} - {# Close previous row #} - {% if confPrev != '' %} - {# Fill empty cells at the end of the row #} - {% for key, buildKey in buildKeys %} - {% if key > buildKeyIndexPrinted %} - <td></td> + {# Loop all the branches #} + {% for branch in branches %} + + {# Get all build keys #} + {% set buildKey = '' %} + {% set buildKeys = [] %} + {% set dates = [] %} + {% for run in projectBuilds %} + {% if run.branch == branch %} + {% if buildKey != run.buildKey %} + {% set buildKey = run.buildKey %} + {% set buildKeys = buildKeys|merge([run.buildKey]) %} + {% set dates = dates|merge([run.timestamp]) %} + {% endif %} + {% endif %} + {% endfor %} + + {# Check if testset run for this branch #} + {% set testsetBranch = 0 %} + {% for run in testsetRuns if run.getBranchName == branch %} + {% set testsetBranch = 1 %} + {% endfor %} + + {# Show branch if testset run for it #} + {% if testsetBranch %} + <div class="panel panel-info"> + <div class="panel-heading"> + <h4 class="panel-title bold">{{ branch }}</h4> + </div> + <div class="panel-body"> + <div class="table-responsive"> + <table class="table table-striped"> + <thead> + <tr> + <th class="bold rightBorder">{{ testset.getName }}</th> + {% for key, buildKey in buildKeys %} + <th class="center"> + {% if buildKey|length > 6 %} + <span class="clickOnTouch" data-toggle="tooltip" data-placement="top" + title="{{ buildKey }}">{{ buildKey|slice(0, 4) }}... + </span> + {% else %} + {{ buildKey }} {% endif %} - {% endfor %} - </tr> + <br> + <span class="gray"><small>{{ dates[key]|date("m-d") }}</small></span> + </th> + {% endfor %} + </tr> + </thead> + <tbody> + {% set confPrev = '' %} + {% set buildKeyIndexPrinted = -1 %} + {% set buildKeyFound = 0 %} + {% for run in testsetRuns if run.getBranchName == branch %} + + {# New row for each conf #} + {% if confPrev != run.getConfName %} + {# Close previous row #} + {% if confPrev != '' %} + {# Fill empty cells at the end of the row #} + {% for key, buildKey in buildKeys %} + {% if key > buildKeyIndexPrinted %} + <td></td> + {% endif %} + {% endfor %} + </tr> + {% endif %} + <tr> + <td class="rightBorder"><small>{{ run.getConfName }}</small></td> + {% set buildKeyIndexPrinted = -1 %} {% endif %} - <tr> - <td class="rightBorder"><small>{{ run.getConfName }}</small></td> - {% set buildKeyIndexPrinted = -1 %} - {% endif %} - {# Result per build key #} - {% set buildKeyFound = 0 %} - {% for key, buildKey in buildKeys %} - {# Print each column only once (checked based on column index key and buildKeyFound flag) #} - {% if key > buildKeyIndexPrinted and not buildKeyFound %} - {% if buildKey == run.getBuildKey %} - {# Print result #} - {% set flaky = '' %} - {% if run.getResult == constant('testsetRun::RESULT_SUCCESS') %} - {% if run.getRun == 1 %} - {% set resultIcon = 'glyphicon glyphicon-ok green' %} + {# Result per build key #} + {% set buildKeyFound = 0 %} + {% for key, buildKey in buildKeys %} + {# Print each column only once (checked based on column index key and buildKeyFound flag) #} + {% if key > buildKeyIndexPrinted and not buildKeyFound %} + {% if buildKey == run.getBuildKey %} + {# Print result #} + {% set flaky = '' %} + {% if run.getResult == constant('TestsetRun::RESULT_SUCCESS') %} + {% if run.getRun == 1 %} + {% set resultIcon = 'glyphicon glyphicon-ok green' %} + {% else %} + {# Flaky #} + {% set resultIcon = 'glyphicon glyphicon-ok-sign green' %} + {% set flaky = ' (on run ' ~ run.getRun ~ ' as flaky)' %} + {% endif %} + {% elseif run.getResult == constant('TestsetRun::RESULT_FAILURE') %} + {% set resultIcon = 'glyphicon glyphicon-remove red' %} {% else %} - {# Flaky #} - {% set resultIcon = 'glyphicon glyphicon-ok-sign green' %} - {% set flaky = ' (on run ' ~ run.getRun ~ ' as flaky)' %} + {% set resultIcon = '' %} {% endif %} - {% elseif run.getResult == constant('testsetRun::RESULT_FAILURE') %} - {% set resultIcon = 'glyphicon glyphicon-remove red' %} - {% else %} - {% set resultIcon = '' %} - {% endif %} - {% if (run.getDuration / 10) > 60 %} - {% set durationFormatted = ' (00:' ~ (run.getDuration/10)|date("i:s") ~ ')' %} + {% if (run.getDuration / 10) > 60 %} + {% set durationFormatted = ' (00:' ~ (run.getDuration/10)|date("i:s") ~ ')' %} + {% else %} + {% set durationFormatted = '' %} + {% endif %} + <td class="center"> + <span class="spaceHorizontal {{ resultIcon }} clickOnTouch" + data-toggle="tooltip" data-placement="top" data-html="true" + title="<table> + <tr><th>Build key: </th><td>{{ buildKey }}</td></tr> + <tr><th>Configuration: </th><td>{{ run.getConfName }}</td></tr> + <tr><th>Timestamp: </th><td>{{ run.getTimestamp }}</td></tr> + <tr><th>Result: </th><td>{{ run.getResult }} {{ flaky }}</td></tr> + <tr><th>Duration: </th><td>{{ run.getDuration / 10 }} s {{ durationFormatted }}</td></tr> + <tr><th>Run #: </th><td>{{ run.getRun }}</td></tr> + <tr><th>Insignificant: </th><td>{% if run.getInsignificant %}yes{% else %}no{% endif %}</td></tr> + </table>"> + </span> + </td> + {% set buildKeyFound = 1 %} {% else %} - {% set durationFormatted = '' %} + {# Print empty cell #} + <td></td> {% endif %} - <td class="center"> - <span class="spaceHorizontal {{ resultIcon }} clickOnTouch" - data-toggle="tooltip" data-placement="top" data-html="true" - title="<table> - <tr><th>Build key: </th><td>{{ buildKey }}</td></tr> - <tr><th>Configuration: </th><td>{{ run.getConfName }}</td></tr> - <tr><th>Timestamp: </th><td>{{ run.getTimestamp }}</td></tr> - <tr><th>Result: </th><td>{{ run.getResult }} {{ flaky }}</td></tr> - <tr><th>Duration: </th><td>{{ run.getDuration / 10 }} s {{ durationFormatted }}</td></tr> - <tr><th>Run #: </th><td>{{ run.getRun }}</td></tr> - <tr><th>Insignificant: </th><td>{% if run.getInsignificant %}yes{% else %}no{% endif %}</td></tr> - </table>"> - </span> - </td> - {% set buildKeyFound = 1 %} - {% else %} - {# Print empty cell #} - <td></td> + {% set buildKeyIndexPrinted = key %} {% endif %} - {% set buildKeyIndexPrinted = key %} + {% endfor %} + {% set confPrev = run.getConfName %} + {% endfor %} + + {# Close last row (also fill empty cells at the end of the row) #} + {% for key, buildKey in buildKeys %} + {% if key > buildKeyIndexPrinted %} + <td></td> {% endif %} {% endfor %} - {% set confPrev = run.getConfName %} - {% endfor %} + </tr> + </tbody> + </table> + </div> {# /table-responsive #} + </div> {# /panel-body #} + </div> {# /panel... #} + {% endif %} {# testsetBranch #} + {% endfor %} - {# Close last row (also fill empty cells at the end of the row) #} - {% for key, buildKey in buildKeys %} - {% if key > buildKeyIndexPrinted %} - <td></td> - {% endif %} - {% endfor %} - </tr> - </tbody> - </table> - </div> {# /table-responsive #} - </div> {# /panel-body #} - </div> {# /panel... #} - {% endif %} {# testsetBranch #} - {% endfor %} + {% else %} {# runsAvailable #} + <div class="alert alert-danger" role="alert"> + No test result data available for testset {{ testset.getName }} in project {{ testset.getProjectName }}! + </div> + {% endif %} </div> {# /col... #} </div> {# /row #} |