TestTimeSort

This commit is contained in:
José David Guillén 2022-07-26 13:54:59 +02:00
commit cbbecd65c6

54
TestTimeSort.html Normal file
View File

@ -0,0 +1,54 @@
<html>
<head>
<title>Test Time Sort</title>
<style>textarea {width: 100%;height: 240px};</style>
<script>
window.onload = init;
function init() {
document.getElementById("input").addEventListener("change", processTestResults);
}
function processTestResults(e) {
const txt = e.target.value;
const regex1 = /Passed (?<testName>(.)+) \[(?<testTime>(\d)+) (?<testTimeUnit>(m?s))\]/g;
txt.match(regex1);
let matches, output = [];
while (matches = regex1.exec(txt)) {
output.push([matches.groups.testName, +matches.groups.testTime, matches.groups.testTimeUnit]);
}
output.sort( (a,b)=>(b[1]*(b[2]=='s'?1000:1)-a[1]*(a[2]=='s'?1000:1)) );
let trs = '';
for(let i=0;i<output.length;i++)
{
trs += `<tr><td>${output[i][0]}</td><td>${output[i][1]} ${output[i][2]}</td>`;
}
document.getElementById("output").innerHTML = '<table><thead><tr><th>Test Name</th><th>Time</th><tbody>'+trs+'</table>';
}
</script>
</head>
<body>
<h1>Test Time Sort</h1>
<p>Paste here the "Test Assemblies" result to sort the test by time</p>
<textarea id="input">
Passed IncludeSapInstallationNumbers [11 s]
Passed CheckoutServiceInternalCreateSubscriptionInvoicesDefaultDirectEndCustomerTest [14 s]
Passed CheckoutServiceInternalCreateSubscriptionInvoicesDefaultPartnerCustomerTest [15 s]
Passed CheckoutServiceInternalGetSubscriptionCustomerIdsToInvoiceOnDateFilterTest [21 s]
Passed CheckoutServiceInternalGetSubscriptionCustomerIdsToInvoiceOnDateTest1 [21 s]
Passed CheckoutServiceInternalGetSubscriptionCustomerIdsToInvoiceOnDateTest2 [28 s]
Passed CheckoutServiceInternalGetSubscriptionPeriodsToInvoiceOnDateDirectEndCustomerTest1 [10 s]
Passed CheckoutServiceInternalGetSubscriptionPeriodsToInvoiceOnDateDirectEndCustomerTest2 [14 s]
Passed CheckoutServiceInternalGetSubscriptionPeriodsToInvoiceOnDateMultiTest1 [21 s]
Passed CheckoutServiceInternalGetSubscriptionPeriodsToInvoiceOnDateMultiTest2 [30 s]
Passed CheckoutServiceInternalGetSubscriptionPeriodsToInvoiceOnDatePartnerCustomerTest1 [11 s]
Passed CheckoutServiceInternalGetSubscriptionPeriodsToInvoiceOnDatePartnerCustomerTest2 [14 s]
Passed CheckoutServiceInternalIncludeIncludeCouponCodesTest [10 s]
Passed CheckoutServiceInternalIncludeIncludeLinesAdditionalTest [11 s]
Passed CheckoutServiceInternalIncludeIncludeLinesExtraTest [10 s]
Passed CheckoutServiceInternalIncludeIncludeLinesReductionTest [11 s]
</textarea>
<div id="output"></div>
</body>
</html>