Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage tool: Add spec status and UI to sort specs by status. #88

Merged
merged 1 commit into from
Apr 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tools/coverage/coverage.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,19 @@ tr:hover {
display: none;
}

.spec-view #spec-controls {
.spec-view #spec-controls,
.summary-view #summary-controls {
display: block;
}

.spec-view #summary-controls,
.summary-view #spec-controls {
display: none;
}
}

.rec, .pr, .high { background-color: #7f7 }
.cr, .lcwd, .med-high { background-color: #cf7 }
.wd, .med { background-color: #ff7 }
.fpwd, .med-low { background-color: #fc7 }
.ed, .low { background-color: #f77 }

43 changes: 32 additions & 11 deletions tools/coverage/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ var controls = (function($) {
var lvl = state.level || 1;
$("input[name=level][value=" + lvl + "]").get(0).checked = true;
self.setLevel(lvl);

var showAll = !!state['show-all'];
self.displayAllReqs(showAll);
$('#show-all').get(0).checked = showAll;

var showDetails = !!state['show-details']
self.displayDetails(showDetails);
$('#show-details').get(0).checked = showDetails;

var sortBy = state['sort-by'] == 'state' ? 1 : 0;
$("select[name=sort-by]").selectedIndex = sortBy;
}

function getState() {
Expand Down Expand Up @@ -219,6 +222,15 @@ SpecModel.prototype.findOutOfScope = function() {

var specs = null;
var $target = null;
var STATUS_VALUES = {
"ED": 0,
"FPWD": 1,
"WD": 2,
"LCWD": 3,
"CR": 4,
"PR": 5,
"REC": 6
};

function clone(obj) {
var r = {};
Expand Down Expand Up @@ -271,13 +283,17 @@ SpecModel.prototype.findOutOfScope = function() {
return allowHalfs(time / Y) + "yr";
});

Handlebars.registerHelper('getColor', function(percent) {
if (percent == null) return 'transparent';
if (percent > 79) return '#0f0';
if (percent > 59) return '#cf6';
if (percent > 39) return '#ff6';
if (percent > 19) return '#fc6';
return '#f00';
Handlebars.registerHelper('percentToValue', function(percent) {
if (percent == null) return '';
if (percent > 79) return 'high';
if (percent > 59) return 'med-high';
if (percent > 39) return 'med';
if (percent > 19) return 'med-low';
return 'low';
});

Handlebars.registerHelper('lowerCase', function(str) {
return str.toLowerCase();
});

return {
Expand Down Expand Up @@ -368,7 +384,8 @@ SpecModel.prototype.findOutOfScope = function() {
assumeTooling: 1 * $("input[name=assume-tooling]").val(),
reviewTime: 1 * $("input[name=review-time]").val(),
testTime: 1 * $("input[name=test-time]").val(),
reviewSuccess: 1 * $("input[name=review-success]").val()
reviewSuccess: 1 * $("input[name=review-success]").val(),
sortBy: $("select[name=sort-by]").val()
};
}

Expand Down Expand Up @@ -434,12 +451,16 @@ SpecModel.prototype.findOutOfScope = function() {
_specs.forEach(function(spec) {
getData(spec, function(data) {
count--;
view.children.push(makeViewFromSpecData(spec, data, getMultipliers(spec)));
var multipliers = getMultipliers(spec);
view.children.push(makeViewFromSpecData(spec, data, multipliers));
if (count === 0) {
view.children.reduce(View.calculateTotals, view);
view.children.forEach(createBarGraph);
view.children.sort(function(a, b) {
return a.model.id > b.model.id ? 1 : -1;
a = a.model;
b = b.model;
if (multipliers.sortBy == "id" || a.status == b.status) return a.id > b.id ? 1 : -1;
return STATUS_VALUES[b.status] - STATUS_VALUES[a.status];
});
callback(view);
}
Expand Down
29 changes: 19 additions & 10 deletions tools/coverage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2>{{ model.title }}<small> - [<a href='{{ model.href }}'>document</a>]</small>
<td>{{ formatNumber existingTests }}</td>
<td>{{ formatNumber desiredTests }}</td>
<td class=detailed-data>{{ formatNumber exceedingTests }}</td>
<td style="background-color: {{ getColor percent }}">{{ formatNumber percent }}</td>
<td class="{{ percentToValue percent }}">{{ formatNumber percent }}</td>
<td>
<div style="width:610px">
{{#if desiredTests }}
Expand All @@ -54,13 +54,14 @@ <h2>{{ phase }} of the Coremob and TV Profiles</h2>
<table>
<tr>
<th>Spec</th>
<th>Rec Track Status</th>
<th>Existing Tests</th>
<th class=detailed-data>Tests Awaiting Review</th>
<th class=detailed-data>Tests Passing Review</th>
<th>Missing tests</th>
<th>Desired tests</th>
<th class=detailed-data>Exceeding tests</th>
<th>Coverage (%)</th>
<th>Coverage&nbsp;(%)</th>
<th>Test Development Time</th>
<th>Test Review Time</th>
<th>Total Time</th>
Expand All @@ -69,13 +70,14 @@ <h2>{{ phase }} of the Coremob and TV Profiles</h2>
{{#each children}}
<tr>
<td>[<a href='{{ href }}' title='{{ model.title }}'>{{ model.id }}</a>]{{#if model.refTestBased}}*{{/if}}</td>
<td class="{{ lowerCase model.status }}">{{ model.status }}</td>
<td>{{ formatNumber existingTests }}</td>
<td class=detailed-data>{{ formatNumber testsAwaitingReview }}</td>
<td class=detailed-data>{{ formatNumber testsPassingReview }}</td>
<td>{{ formatNumber missingTests }}</td>
<td>{{ formatNumber desiredTests }}</td>
<td class=detailed-data>{{ formatNumber exceedingTests }}</td>
<td style="background-color: {{ getColor percent }}">{{ formatNumber percent }}</td>
<td class="{{ percentToValue percent }}">{{ formatNumber percent }}</td>
<td>{{ formatTime testTime }}</td>
<td>{{ formatTime reviewTime }}</td>
<td title="{{ totalTime }}">{{ formatTime totalTime }}</td>
Expand All @@ -97,7 +99,7 @@ <h2>{{ phase }} of the Coremob and TV Profiles</h2>
<td>{{ formatNumber missingTests }}</td>
<td>{{ formatNumber desiredTests }}</td>
<td class=detailed-data>{{ formatNumber exceedingTests }}</td>
<td style="background-color: {{ getColor percent }}">{{ formatNumber percent }}</td>
<td class="{{ percentToValue percent }}">{{ formatNumber percent }}</td>
<td>{{ formatTime testTime }}</td>
<td>{{ formatTime reviewTime }}</td>
<td title="{{ totalTime }}">{{ formatTime totalTime }}</td>
Expand All @@ -124,11 +126,11 @@ <h1>Open Web Platform Test Suite - <small>Coverage Analysis and Development Time
<div id='output'></div>

<ul id=color-coding>
<li style="background-color:#0F0">80 - 100%</li>
<li style="background-color:#CF6">60 - 79%</li>
<li style="background-color:#FF6">40 - 69%</li>
<li style="background-color:#FC6">20 - 39%</li>
<li style="background-color:#F00">0 - 19%</li>
<li class="high">80 - 100%</li>
<li class="med-high">60 - 79%</li>
<li class="med">40 - 69%</li>
<li class="med-low">20 - 39%</li>
<li class="low">0 - 19%</li>
</ul>

<form action="" method="get" id="form" accept-charset="utf-8">
Expand All @@ -148,7 +150,14 @@ <h4>Section depth</h4>
<label><input type='checkbox' name='show-details' id="show-details"> Show detailed coverage data.</label>
</p>
</div>
<div style="clear:both">
<div id="summary-controls" style="clear:both">
<h4>Table Sort</h4>

<p>
Sort by: <select name='sort-by' id='sort-by'><option value=id select>spec short name</option><option value=status>rec track status</option></select>
</p>
</div>
<div>
<h4>Desired number of test</h4>
<ul>
<li>Tests per RFC2119 keyword: <input type='number' name='rfc2119' size='4' value='4' min='0'></li>
Expand Down