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

Test Report: Implement table sorting #2134

Merged
merged 3 commits into from
Jul 19, 2022
Merged
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
78 changes: 49 additions & 29 deletions locust/templates/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ <h2>Request Statistics</h2>
<table class="stats">
<thead>
<tr>
<th>Method</th>
<th>Name</th>
<th># Requests</th>
<th># Fails</th>
<th>Average (ms)</th>
<th>Min (ms)</th>
<th>Max (ms)</th>
<th>Average size (bytes)</th>
<th>RPS</th>
<th>Failures/s</th>
<th class="sortable">Method</th>
<th class="sortable">Name</th>
<th class="sortable"># Requests</th>
<th class="sortable"># Fails</th>
<th class="sortable">Average (ms)</th>
<th class="sortable">Min (ms)</th>
<th class="sortable">Max (ms)</th>
<th class="sortable">Average size (bytes)</th>
<th class="sortable">RPS</th>
<th class="sortable">Failures/s</th>
</tr>
</thead>
<tbody>
Expand All @@ -90,16 +90,16 @@ <h2>Response Time Statistics</h2>
<table class="stats">
<thead>
<tr>
<th>Method</th>
<th>Name</th>
<th>50%ile (ms)</th>
<th>60%ile (ms)</th>
<th>70%ile (ms)</th>
<th>80%ile (ms)</th>
<th>90%ile (ms)</th>
<th>95%ile (ms)</th>
<th>99%ile (ms)</th>
<th>100%ile (ms)</th>
<th class="sortable">Method</th>
<th class="sortable">Name</th>
<th class="sortable">50%ile (ms)</th>
<th class="sortable">60%ile (ms)</th>
<th class="sortable">70%ile (ms)</th>
<th class="sortable">80%ile (ms)</th>
<th class="sortable">90%ile (ms)</th>
<th class="sortable">95%ile (ms)</th>
<th class="sortable">99%ile (ms)</th>
<th class="sortable">100%ile (ms)</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -127,10 +127,10 @@ <h2>Failures Statistics</h2>
<table class="stats">
<thead>
<tr>
<th>Method</th>
<th>Name</th>
<th>Error</th>
<th>Occurrences</th>
<th class="sortable">Method</th>
<th class="sortable">Name</th>
<th class="sortable">Error</th>
<th class="sortable">Occurrences</th>
</tr>
</thead>
<tbody>
Expand All @@ -153,10 +153,10 @@ <h2>Exceptions Statistics</h2>
<table>
<thead>
<tr>
<th>Count</th>
<th>Message</th>
<th>Traceback</th>
<th>Nodes</th>
<th class="sortable">Count</th>
<th class="sortable">Message</th>
<th class="sortable">Traceback</th>
<th class="sortable">Nodes</th>
</tr>
</thead>
<tbody>
Expand All @@ -183,7 +183,7 @@ <h2>Charts</h2>
<h2>Final ratio</h2>
<div class="tasks" data-tasks="{{ escape(tasks) }}"></div>
</div>

</div>

{# <script type="text/javascript" src="/static/jquery-1.11.3.min.js"></script> #}
Expand Down Expand Up @@ -238,5 +238,25 @@ <h2>Final ratio</h2>

fillTasksFromObj()
</script>

<script>
$('.sortable').click(function() {
var table = $(this).parents('table').eq(0)
var rowArray = table.find('tr:gt(0)').toArray()
var aggregatedRow = rowArray.pop()
var rows = rowArray.sort(comparer($(this).index()))
this.asc = !this.asc
if (!this.asc){rows = rows.reverse()}
for (var i = 0; i < rows.length; i++){table.append(rows[i])}
table.append(aggregatedRow)
})
function comparer(index) {
return function(a,b) {
var valA = getCellValue(a, index), valB = getCellValue(b, index)
return $.isNumeric(valA) && $.isNumeric(valB) ? valA - valB : valA.toString().localeCompare(valB)
}
}
function getCellValue(row, index) { return $(row).children('td').eq(index).text() }
</script>
</body>
</html>