Skip to content

Commit 510229e

Browse files
committed
First stab at removing criticality
1 parent 81e8251 commit 510229e

23 files changed

+62
-303
lines changed

src/robot/htmldata/rebot/log.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ <h1>Opening Robot Framework log failed</h1>
121121
window.testdata.ensureLoaded(id, function (ids) {
122122
util.map(ids, expandElementWithId);
123123
if (ids.length) {
124-
expandCriticalFailed(window.testdata.findLoaded(util.last(ids)));
124+
expandFailed(window.testdata.findLoaded(util.last(ids)));
125125
window.location.hash = '';
126126
window.location.hash = id;
127127
highlightLinkTarget();
@@ -265,7 +265,6 @@ <h2>{{= testOrTask('{Test}')}} Execution Errors</h2>
265265
<span class="elapsed" title="Elapsed time">${times.elapsedTime}</span>
266266
<span class="label ${status.toLowerCase()}">{{= testOrTask('{TEST}')}}</span>
267267
<span class="name">{{html name}}</span>
268-
{{if !isCritical}}(non-critical){{/if}}
269268
</div>
270269
<div class="element-header-right" onclick="stopPropagation(event)" title="">
271270
<a class="expand" title="Expand all" href="javascript:expandAll('${id}')"></a>
@@ -304,7 +303,7 @@ <h2>{{= testOrTask('{Test}')}} Execution Errors</h2>
304303
</tr>
305304
<tr>
306305
<th>Status:</th>
307-
<td><span class="label ${status.toLowerCase()}">${status}</span> ({{if isCritical}}critical{{else}}non-critical{{/if}})</td>
306+
<td><span class="label ${status.toLowerCase()}">${status}</span></td>
308307
</tr>
309308
{{if message()}}
310309
<tr>

src/robot/htmldata/rebot/log.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function expandSuite(suite) {
4646
if (suite.status == "PASS")
4747
expandElement(suite);
4848
else
49-
expandCriticalFailed(suite);
49+
expandFailed(suite);
5050
}
5151

5252
function expandElement(item, retryCount) {
@@ -79,11 +79,11 @@ function loadAndExpandElementIds(ids) {
7979
}
8080
}
8181

82-
function expandCriticalFailed(element) {
82+
function expandFailed(element) {
8383
if (element.status == "FAIL") {
8484
window.elementsToExpand = [element];
8585
window.expandDecider = function (e) {
86-
return e.status == "FAIL" && (e.isCritical === undefined || e.isCritical);
86+
return e.status == "FAIL";
8787
};
8888
expandRecursively();
8989
}

src/robot/htmldata/rebot/model.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ window.model = (function () {
3636
};
3737
suite.searchTestsByTag = function (tag) {
3838
return suite.searchTests(function (test) {
39-
if (tag.info == "critical" || tag.info == "non-critical")
40-
return containsTagPattern(test.tags, tag.label);
4139
if (tag.combined)
4240
return containsTagPattern(test.tags, tag.combined);
4341
return containsTag(test.tags, tag.label);
@@ -51,11 +49,6 @@ window.model = (function () {
5149
return true;
5250
});
5351
};
54-
suite.criticalTests = function () {
55-
return suite.searchTests(function (test) {
56-
return test.isCritical;
57-
});
58-
};
5952
return suite;
6053
}
6154

@@ -133,7 +126,6 @@ window.model = (function () {
133126
if (test.isChildrenLoaded)
134127
return test.keywords();
135128
};
136-
test.isCritical = data.isCritical;
137129
test.tags = data.tags;
138130
test.message = data.message;
139131
test.matchesTagPattern = function (pattern) {
@@ -243,7 +235,7 @@ window.stats = (function () {
243235

244236
function totalStatElem(data) {
245237
var stat = statElem(data);
246-
stat.type = stat.label == 'Critical Tests' ? 'critical' : 'all';
238+
stat.type = 'all';
247239
return stat;
248240
}
249241

@@ -270,8 +262,10 @@ window.stats = (function () {
270262
}
271263

272264
function calculatePercents(total, passed, failed) {
273-
if (total == 0)
265+
if (total == 0) {
274266
return [0.0, 0.0];
267+
}
268+
275269
var pass = 100.0 * passed / total;
276270
var fail = 100.0 * failed / total;
277271
if (pass > 0 && pass < 0.1)

src/robot/htmldata/rebot/report.html

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ <h1>Opening Robot Framework report failed</h1>
6060

6161
function setBackground(topsuite) {
6262
var color;
63-
if (topsuite.criticalFailed)
63+
if (topsuite.totalFailed)
6464
color = window.settings.background.fail;
65-
else if (topsuite.totalFailed)
66-
color = window.settings.background.nonCriticalFail;
6765
else
6866
color = window.settings.background.pass;
6967
$('body').css('background-color', color);
@@ -83,16 +81,6 @@ <h1>Opening Robot Framework report failed</h1>
8381
}
8482

8583
function addCustomSortersForDetails() {
86-
$.tablesorter.addParser({
87-
id: 'criticality',
88-
type: 'numeric',
89-
is: function(s) {
90-
return false; // do not auto-detect
91-
},
92-
format: function(s) {
93-
return s === 'yes' ? 0 : 1;
94-
}
95-
});
9684
$.tablesorter.addParser({
9785
id: 'times',
9886
type: 'text',
@@ -132,7 +120,7 @@ <h1>Opening Robot Framework report failed</h1>
132120
renderTotalSelector(name);
133121
if (name) {
134122
renderTotalDetails(name);
135-
var title = name == 'critical' ? 'Critical {Test}s' : 'All {Test}s'
123+
var title = 'All {Test}s'
136124
updatePrintSelector(testOrTask(title));
137125
}
138126
scrollToSelector('totals', name);
@@ -145,9 +133,8 @@ <h1>Opening Robot Framework report failed</h1>
145133
}
146134

147135
function renderTotalDetails(name) {
148-
var index = (name == 'critical') ? 0 : 1;
149-
var stat = window.testdata.statistics().total[index];
150-
var tests = getTotalTests(name);
136+
var stat = window.testdata.statistics().total[0];
137+
var tests = window.testdata.suite().allTests().sort(sortByStatus)
151138
stat.totalTime = calculateTotalTime(tests);
152139
$.tmpl('tagOrTotalDetailsTemplate', stat).appendTo('#details-header');
153140
drawTestDetailsTable(tests, true);
@@ -302,21 +289,13 @@ <h1>Opening Robot Framework report failed</h1>
302289
function sortByStatus(t1, t2) {
303290
if (t1.status != t2.status)
304291
return t1.status == 'FAIL' ? -1 : 1;
305-
if (t1.isCritical != t2.isCritical)
306-
return t1.isCritical ? -1 : 1;
307292
return t1.fullName < t2.fullName ? -1 : 1;
308293
}
309294

310295
function getTestsHavingTag(tag) {
311296
return window.testdata.suite().searchTestsByTag(tag).sort(sortByStatus);
312297
}
313298

314-
function getTotalTests(name) {
315-
if (name == 'critical')
316-
return window.testdata.suite().criticalTests().sort(sortByStatus);
317-
return window.testdata.suite().allTests().sort(sortByStatus);
318-
}
319-
320299
function calculateTotalTime(tests) {
321300
var total = 0;
322301
for (var i = 0, len = tests.length; i < len; i++)
@@ -351,12 +330,12 @@ <h1>Opening Robot Framework report failed</h1>
351330
}
352331

353332
function configureTableSorter(sortByStatus) {
354-
var config = {headers: {3: {sorter: 'criticality'},
355-
6: {sortInitialOrder: 'desc'},
356-
7: {sorter: 'times'}},
333+
// FIXME: define sorting by status, PASS, SKIP, FAIL
334+
var config = {headers: {5: {sortInitialOrder: 'desc'},
335+
6: {sorter: 'times'}},
357336
selectorSort: '.details-col-header'};
358337
if (sortByStatus)
359-
config['sortList'] = [[4, 0], [3, 0]];
338+
config['sortList'] = [[3, 0]];
360339
$('#test-details').tablesorter(config);
361340
}
362341

@@ -393,12 +372,9 @@ <h2>Summary Information</h2>
393372
<table class="details">
394373
<tr>
395374
<th>Status:</th>
396-
{{if criticalFailed}}
397-
<td><a href="#totals?critical" onclick="totalDetailSelected('critical')"
398-
class="fail">${criticalFailed} critical {{= testOrTask('{test}')}}{{if criticalFailed != 1}}s{{/if}} failed</a></td>
399-
{{else totalFailed}}
400-
<td><a href="#totals?critical" onclick="totalDetailSelected('critical')"
401-
class="pass">All critical {{= testOrTask('{test}')}}s passed</a></td>
375+
{{if totalFailed}}
376+
<td><a href="#totals?all" onclick="totalDetailSelected('all')"
377+
class="fail">${totalFailed} {{= testOrTask('{test}')}}{{if totalFailed != 1}}s{{/if}} failed</a></td>
402378
{{else}}
403379
<td><a href="#totals?all" onclick="totalDetailSelected('all')"
404380
class="pass">All {{= testOrTask('{test}')}}s passed</a></td>
@@ -504,10 +480,6 @@ <h2 id="${linkTarget}">{{= testOrTask('{Test}')}} Details</h2>
504480
<tr class="selector">
505481
<th>Type:</th>
506482
<td id="normal-selector">
507-
<input id="radio-critical" type="radio" name="totals-radio"
508-
onclick="totalDetailSelected('critical')"
509-
{{if selected == 'critical'}}checked="checked"{{/if}}>
510-
<label for="radio-critical">Critical {{= testOrTask('{Test}')}}s</label><br>
511483
<input id="radio-all" type="radio" name="totals-radio"
512484
onclick="totalDetailSelected('all')"
513485
{{if selected == 'all'}}checked="checked"{{/if}}>
@@ -799,9 +771,6 @@ <h3>Patterns</h3>
799771
<div class='details-col-toggle' onclick="toggleDetailsColumn('tags')">&times;</div>
800772
<div class='details-col-header'>Tags</div>
801773
</th>
802-
<th class="details-col-crit" title="Critical">
803-
<div class='details-col-header'>Crit.</div>
804-
</th>
805774
<th class="details-col-status" title="Status">
806775
<div class='details-col-header'>Status</div>
807776
</th>
@@ -837,7 +806,6 @@ <h3>Patterns</h3>
837806
{{/if}}
838807
<td class="details-col-doc"><div class="doc details-limited">{{html doc()}}</div></td>
839808
<td class="details-col-tags"><div>{{html tags.join(', ')}}</div></td>
840-
<td class="details-col-crit"><div>{{if isCritical}}yes{{else}}no{{/if}}</div></td>
841809
<td class="details-col-status"><div><span class="label ${status.toLowerCase()}">${status}</span></div></td>
842810
<td class="details-col-msg"><div class="message details-limited">{{html message()}}</div></td>
843811
<td class="details-col-elapsed"><div>${times.elapsedTime}</div></td>

src/robot/htmldata/rebot/testdata.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,28 @@ window.testdata = function () {
9090
}
9191

9292
function createTest(parent, element, strings, index) {
93-
var statusElement = element[5];
93+
var statusElement = element[4];
9494
var test = model.Test({
9595
parent: parent,
9696
id: 't' + (index + 1),
9797
name: strings.get(element[0]),
9898
doc: function () {
99-
var doc = strings.get(element[3]);
99+
var doc = strings.get(element[2]);
100100
this.doc = function () { return doc; };
101101
return doc;
102102
},
103103
timeout: strings.get(element[1]),
104-
isCritical: element[2],
105104
status: parseStatus(statusElement),
106105
message: function () {
107106
var msg = createMessage(statusElement, strings);
108107
this.message = function () { return msg; };
109108
return msg;
110109
},
111110
times: model.Times(times(statusElement)),
112-
tags: tags(element[4], strings),
113-
isChildrenLoaded: typeof(element[6]) !== 'number'
111+
tags: tags(element[3], strings),
112+
isChildrenLoaded: typeof(element[5]) !== 'number'
114113
});
115-
lazyPopulateKeywordsFromFile(test, element[6], strings);
114+
lazyPopulateKeywordsFromFile(test, element[5], strings);
116115
return test;
117116
}
118117

@@ -161,10 +160,7 @@ window.testdata = function () {
161160
return {
162161
total: stats[0],
163162
totalPassed: stats[1],
164-
totalFailed: stats[0] - stats[1],
165-
critical: stats[2],
166-
criticalPassed: stats[3],
167-
criticalFailed: stats[2] - stats[3]
163+
totalFailed: stats[2],
168164
};
169165
}
170166

src/robot/htmldata/rebot/view.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ $.template('statColumnsTemplate',
172172
);
173173

174174
$.template('suiteStatusMessageTemplate',
175-
'${critical} critical {{= testOrTask("{test}")}}, ' +
176-
'${criticalPassed} passed, ' +
177-
'<span class="{{if criticalFailed}}fail{{else}}pass{{/if}}">${criticalFailed} failed</span><br>' +
178175
'${total} {{= testOrTask("{test}")}} total, ' +
179176
'${totalPassed} passed, ' +
180177
'<span class="{{if totalFailed}}fail{{else}}pass{{/if}}">${totalFailed} failed</span>'

src/robot/libraries/BuiltIn.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,36 +2200,6 @@ def _get_test_in_teardown(self, kwname):
22002200
raise RuntimeError("Keyword '%s' can only be used in test teardown."
22012201
% kwname)
22022202

2203-
@run_keyword_variant(resolve=1)
2204-
def run_keyword_if_all_critical_tests_passed(self, name, *args):
2205-
"""Runs the given keyword with the given arguments, if all critical tests passed.
2206-
2207-
This keyword can only be used in suite teardown. Trying to use it in
2208-
any other place will result in an error.
2209-
2210-
Otherwise, this keyword works exactly like `Run Keyword`, see its
2211-
documentation for more details.
2212-
"""
2213-
suite = self._get_suite_in_teardown('Run Keyword If '
2214-
'All Critical Tests Passed')
2215-
if suite.statistics.critical.failed == 0:
2216-
return self.run_keyword(name, *args)
2217-
2218-
@run_keyword_variant(resolve=1)
2219-
def run_keyword_if_any_critical_tests_failed(self, name, *args):
2220-
"""Runs the given keyword with the given arguments, if any critical tests failed.
2221-
2222-
This keyword can only be used in a suite teardown. Trying to use it
2223-
anywhere else results in an error.
2224-
2225-
Otherwise, this keyword works exactly like `Run Keyword`, see its
2226-
documentation for more details.
2227-
"""
2228-
suite = self._get_suite_in_teardown('Run Keyword If '
2229-
'Any Critical Tests Failed')
2230-
if suite.statistics.critical.failed > 0:
2231-
return self.run_keyword(name, *args)
2232-
22332203
@run_keyword_variant(resolve=1)
22342204
def run_keyword_if_all_tests_passed(self, name, *args):
22352205
"""Runs the given keyword with the given arguments, if all tests passed.

src/robot/model/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from .message import Message
3333
from .modifier import ModelModifier
3434
from .tags import Tags, TagPattern, TagPatterns
35-
from .criticality import Criticality
3635
from .namepatterns import SuiteNamePatterns, TestNamePatterns
3736
from .visitor import SuiteVisitor
3837
from .totalstatistics import TotalStatisticsBuilder

src/robot/model/criticality.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/robot/model/statistics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, suite, suite_stat_level=-1, tag_stat_include=None,
3030
tag_stat_link=None, rpa=False):
3131
total_builder = TotalStatisticsBuilder(rpa=rpa)
3232
suite_builder = SuiteStatisticsBuilder(suite_stat_level)
33-
tag_builder = TagStatisticsBuilder(suite.criticality, tag_stat_include,
33+
tag_builder = TagStatisticsBuilder(tag_stat_include,
3434
tag_stat_exclude, tag_stat_combine,
3535
tag_doc, tag_stat_link)
3636
suite.visit(StatisticsBuilder(total_builder, suite_builder, tag_builder))

0 commit comments

Comments
 (0)