summaryrefslogtreecommitdiffstats
path: root/non-puppet/qtmetrics2/templates/testset.html
blob: 3cb54e6fc091ff53a51c1d6f27cd3ff2d891c53a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
{#
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Quality Assurance module of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL21$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see http://www.qt.io/terms-conditions. For further
## information use the contact form at http://www.qt.io/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 2.1 or version 3 as published by the Free
## Software Foundation and appearing in the file LICENSE.LGPLv21 and
## LICENSE.LGPLv3 included in the packaging of this file. Please review the
## following information to ensure the GNU Lesser General Public License
## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## As a special exception, The Qt Company gives you certain additional
## rights. These rights are described in The Qt Company LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
## $QT_END_LICENSE$
##
#############################################################################

/**
 * Testset page (list of configurations)
 * @since     24-09-2015
 * @author    Juha Sippola
 */

#}

{% include "header.html" %}

{# Failed/passed bar area size in px #}
{% set BAR_AREA = 120 %}

{# testset as Testset object
/**
 * @var Testset[] testsets
 */
#}

{# testsetRuns as TestsetRun objects
/**
 * @var TestsetRun[] testsetRuns
 */
#}

<ol class="breadcrumb">
{% for link in breadcrumb %}
<li><a href="{{ link.link }}">{{ link.name }}</a></li>
{% endfor %}
<li class="active">{{ testset.getName }}</li>
</ol>

<div class="container-fluid">
<div class="row">

<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">
{{ testset.getName }}
<button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info">
<span class="glyphicon glyphicon-info-sign"></span>
</button>
<small>{{ refreshed }}</small>
</h1>

{##### Info well #####}

<div class="collapse" id="info">
<div class="well infoWell">
<span class="glyphicon glyphicon-info-sign"></span> <strong>Testset</strong><br>
<ul>
<li><strong>Buttons</strong> open a detailed list for the {{ testset.getName }} testset</li>
<li><strong>Latest Status</strong> shows the overall testset status across all branches
<ul>
<li>latest result: overall testset status based on the latest
<strong>{{ masterProject }} {{ masterState }}</strong> builds
(shows failed if failed in one or in several)</li>
<li>failed: number of <strong>{{ masterProject }} {{ masterState }}</strong>
builds where {{ testset.getName }} failed during the last {{ lastDaysFailures }} days
(since {{ sinceDateFailures }})</li>
<li>flaky: number of <strong>all</strong> builds where {{ testset.getName }} failed
on the first run but, when rerun, it passed (during the last {{ lastDaysFlaky }} days,
since {{ sinceDateFlaky }})</li>
</ul>
</li>
<li><strong>Results in Branches</strong> shows the {{ testset.getName }} run results by branch
and their configuration on <strong>{{ masterProject }} {{ masterState }}</strong> builds
<ul>
<li>flags: <span class="label label-default">i</span> = insignificant flag set for the testset on the latest build of the configuration</li>
<li>results: <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') }}</li>
</ul>
</li>
<li>Details on the runs are available as tooltip on result icon</li>
</ul>
</div>
</div>

{##### Buttons #####}

<div>
<div class="btn-group">
{% set link = bpassedTestsetRoute ~ '/' ~ testset.getName|url_encode ~ '/' ~ testset.getProjectName|url_encode %}
<a class="btn btn-primary btn-xs" href="{{ link }}" role="button"><span class="badge">test functions</span><br>blacklisted passes</a>
</div>
<div class="btn-group">
{% set link = bpassedtestsetTestrowsRoute ~ '/' ~ testset.getName|url_encode ~ '/' ~ testset.getProjectName|url_encode %}
<a class="btn btn-primary btn-xs" href="{{ link }}" role="button"><span class="badge">test rows</span><br>blacklisted passes</a>
</div>
<div class="btn-group">
{% set link = durationTestfunctionsRoute ~ '/' ~ testset.getName|url_encode ~ '/' ~ testset.getProjectName|url_encode %}
<a class="btn btn-primary btn-xs" href="{{ link }}" role="button"><span class="badge">test functions</span><br>duration</a>
</div>
</div>
<hr>

{% 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 %}
{%      if testset.getTestsetFlakyCounts.flaky > maxCount %}
{%          set maxCount = testset.getTestsetFlakyCounts.flaky %}
{%      endif %}

{# Print summary #}
<tr>
{# Project name #}
<td><a href="{{ testsetProjectRoute }}/{{ testset.getProjectName|url_encode }}">{{ testset.getProjectName }}</a></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 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 %}
{%      set total = testset.getTestsetFlakyCounts.total %}
<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... #}

{##### Results in Branches #####}

<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="panel-title bold">Results in Branches</h4>
</div>
</div>

{# Get branches #}
{%      set branches = [] %}
{%      for run in projectRuns %}
{%          if run.getBranchName not in branches %}
{%              set branches = branches|merge([run.getBranchName]) %}
{%          endif %}
{%      endfor %}

{# Loop all the branches #}
{%      for branch in branches %}

{# Get all build keys, dates and log links #}
{%          set buildKey = '' %}
{%          set buildKeys = [] %}
{%          set buildKeysShort = [] %}
{%          set dates = [] %}
{%          for run in projectRuns %}
{%              if run.getBranchName == branch %}
{%                  if buildKey != run.getBuildKey %}
{%                      set buildKey = run.getBuildKey %}
{%                      set buildKeys = buildKeys|merge([run.getBuildKey]) %}
{%                      set buildKeysShort = buildKeysShort|merge([run.getShortBuildKey]) %}
{%                      set dates = dates|merge([run.getTimestamp]) %}
{%                  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">configuration</th>
<th class="bold rightBorder">flags</th>
{%              for key, buildKey in buildKeys %}
<th class="center">
{%                  if buildKey == buildKeysShort[key] %}
{{ buildKey }}<br>
{%                  else %}
<span class="clickOnTouch" data-toggle="tooltip" data-placement="top" title="{{ buildKey }}">{{ buildKeysShort[key] }}</span><br>
{%                  endif %}
<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>
{%                      set link = testsetTestfunctionsRoute ~ '/' ~ run.getName|url_encode ~ '/' ~ run.getTestsetProjectName|url_encode ~ '/' ~ run.getConfName|url_encode %}
<td class="rightBorder"><a href="{{ link }}"><small>{{ run.getConfName }}</small></a></td>
{# Flags for the latest build #}
<td class="center rightBorder">
{%                      if run.getInsignificant %}
<span class="label label-default">i</span>
{%                      endif %}
</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' %}
{%                                   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 %}
{%                                   set resultIcon = '' %}
{%                              endif %}
{%                              if run.getDuration > 60 %}
{%                                   set durationFormatted = ' (00:' ~ (run.getDuration|round)|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 }} 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>
{%                          endif %}
{%                          set buildKeyIndexPrinted = key %}
{%                      endif %}{# key #}
{%                  endfor %}{# key #}
{%                  set confPrev = run.getConfName %}
{%              endfor %}{# run #}

{# 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 %}{# key #}
</tr>
</tbody>
</table>
</div> {# .table-responsive #}
</div> {# .panel-body #}
</div> {# .panel... #}
{%          endif %}{# testsetBranch #}
{%      endfor %}{# branch #}

{% else %}{# runsAvailable #}
<div class="alert alert-danger" role="alert">
No test result data available for testset {{ testset.getName }} in project {{ testset.getProjectName }}!
</div>
{% endif %}{# runsAvailable #}
</div> {# .col... #}
</div> {# .row #}
</div> {# /container-fluid #}

{% include "footer.html" %}

{# Local scripts for this page #}
<script src="scripts/tooltip.js"></script>

{% include "close.html" %}