Skip to content

Commit

Permalink
Fixing formatting error in console reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
noconnor committed Oct 27, 2017
1 parent 77f306e commit 4555abf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import com.github.noconnor.junitperf.data.EvaluationContext;
import com.github.noconnor.junitperf.reporting.providers.HtmlReportGenerator;
import com.github.noconnor.junitperf.reporting.ReportGenerator;
import com.github.noconnor.junitperf.reporting.providers.HtmlReportGenerator;
import com.github.noconnor.junitperf.statements.PerformanceEvaluationStatement;
import com.github.noconnor.junitperf.statements.PerformanceEvaluationStatement.PerformanceEvaluationStatementBuilder;
import com.github.noconnor.junitperf.statistics.StatisticsCalculator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
@Slf4j
public class ConsoleReportGenerator implements ReportGenerator {

private static final String PASSED = "PASSED";
private static final String FAILED = "FAILED!!";

@Override
public void generateReport(Set<EvaluationContext> testContexts) {
testContexts.forEach(context -> {
StatisticsCalculator statistics = context.getStatistics();
String throughputStatus = context.isThroughputAchieved() ? "PASSED" : "FAILED!!";
String errorRateStatus = context.isErrorThresholdAchieved() ? "PASSED" : "FAILED!!";
String throughputStatus = context.isThroughputAchieved() ? PASSED : FAILED;
String errorRateStatus = context.isErrorThresholdAchieved() ? PASSED : FAILED;

log.info("Started at: {}", context.getStartTime());
log.info("Invocations: {}", statistics.getEvaluationCount());
Expand All @@ -28,7 +31,7 @@ public void generateReport(Set<EvaluationContext> testContexts) {
log.info("Thread Count: {}", context.getConfiguredThreads());
log.info("Warm up: {}ms", context.getConfiguredWarmUp());
log.info("");
log.info("Execution time: {}ms");
log.info("Execution time: {}ms", context.getConfiguredDuration());
log.info("Throughput: {}/s (Required: {}/s) - {}",
context.getThroughputQps(),
context.getRequiredThroughput(),
Expand All @@ -37,13 +40,15 @@ public void generateReport(Set<EvaluationContext> testContexts) {
log.info("Max latency: {}ms", statistics.getMaxLatency(MILLISECONDS));
log.info("Ave latency: {}ms", statistics.getMeanLatency(MILLISECONDS));
context.getRequiredPercentiles().forEach((percentile, threshold) -> {
String percentileStatus = context.getPercentileResults().get(percentile) ? "PASSED" : "FAILED!!";
String percentileStatus = context.getPercentileResults().get(percentile) ? PASSED : FAILED;
log.info("{}: {}ms (Required: {}ms) - {}",
percentile,
statistics.getLatencyPercentile(percentile, MILLISECONDS),
threshold,
percentileStatus);
});
log.info("");
log.info("");
});
}

Expand Down

0 comments on commit 4555abf

Please sign in to comment.