Skip to content

Commit

Permalink
made the statistics page nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Schäfer committed Sep 25, 2014
1 parent 75e6af2 commit 88f1375
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,27 @@ private void writeIndexFile( File toDir ) {
}

private void writeStatistics() {
printWriter.write( "Number of Classes: " + statistics.numClasses + "<br>" );
printWriter.write( "Number of Scenarios: " + statistics.numScenarios + "<br>" );
printWriter.write( "Number of Cases: " + statistics.numCases + "<br>" );
printWriter.write( "Number of Failed Cases: " + statistics.numFailedCases + "<br>" );
printWriter.write( "Number of Steps: " + statistics.numSteps + "<br>" );
printWriter.write( "Total Time: " + DurationFormatter.format( statistics.durationInNanos ) + "<br>" );

printWriter.write( "<div class='statistics-line'>" );
writeStatisticNumber( statistics.numClasses, "classes" );
writeStatisticNumber( statistics.numScenarios, "scenarios" );
writeStatisticNumber( statistics.numCases, "cases" );
writeStatisticNumber( statistics.numSteps, "steps" );
writeStatisticNumber( "" + statistics.numFailedCases, "failed cases", statistics.numFailedCases > 0 ? "failed" : "" );
writeStatisticNumber( DurationFormatter.format( statistics.durationInNanos ), "total time" );
long averageNanos = statistics.numCases != 0 ? statistics.durationInNanos / statistics.numCases : 0;
printWriter.write( "Average duration per Case: " + DurationFormatter.format( averageNanos ) );
writeStatisticNumber( DurationFormatter.format( averageNanos ), "time / case" );
printWriter.println( "</div>" );
}

private void writeStatisticNumber( int number, String name ) {
writeStatisticNumber( number + "", name, "" );
}

private void writeStatisticNumber( String number, String name ) {
writeStatisticNumber( number, name, "" );
}

private void writeStatisticNumber( String number, String name, String extraClass ) {
printWriter.write( "<div class='statistics-number " + extraClass + "'><i>" + number + "</i><br/><b>" + name + "</b></div>" );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ h1 {
text-shadow: 1px 1px 1px #fff;
}



#toc > .icon-cancel {
position: absolute;
top: 2px;
Expand Down Expand Up @@ -651,6 +649,42 @@ ul.steps li {
padding-top:10px;
}

.statistics-number {
padding: 20px;
border: solid #e0e0e0 1px;
border-radius: 20px;
display: inline-block;
margin-right: 20px;
text-align: center;
background-color: #f0f0f0;
}

.statistics-number.failed {
background-color: #f0f0f0;
}

.statistics-number > i {
font-size: 20px;
color: #222;
font-weight: 200;
font-style: normal;
}

.statistics-number.failed > i {
color: red;
font-weight: bold;
}

.statistics-number > b {
text-transform: uppercase;
font-size: 14px;
color: gray;
}

.statistics-number.failed > b {
color: red;
}

.duration {
opacity: 0.5;
font-size: 10px;
Expand Down

0 comments on commit 88f1375

Please sign in to comment.