From ccf909f85613b858d8cbeaef2461dcc733770ce0 Mon Sep 17 00:00:00 2001 From: Kingsley Hendrickse Date: Sat, 26 May 2012 08:09:05 +0100 Subject: [PATCH] added pending step to reports and charts and colour coded report level legend --- .../jenkins/FeatureReportGenerator.java | 16 +++++- .../net/masterthought/jenkins/Runner.java | 4 +- .../net/masterthought/jenkins/TagObject.java | 4 ++ .../jenkins/XmlChartBuilder.java | 21 ++++--- .../masterthought/jenkins/json/Feature.java | 4 ++ .../resources/templates/featureOverview.vm | 3 + src/main/resources/templates/featureReport.vm | 8 ++- src/main/resources/templates/tagOverview.vm | 3 + src/main/resources/templates/tagReport.vm | 8 ++- velocity.log | 56 +++++++++---------- 10 files changed, 83 insertions(+), 44 deletions(-) diff --git a/src/main/java/net/masterthought/jenkins/FeatureReportGenerator.java b/src/main/java/net/masterthought/jenkins/FeatureReportGenerator.java index d769a6e..cda497b 100644 --- a/src/main/java/net/masterthought/jenkins/FeatureReportGenerator.java +++ b/src/main/java/net/masterthought/jenkins/FeatureReportGenerator.java @@ -78,7 +78,8 @@ public class FeatureReportGenerator { context.put("total_passes", getTotalPasses()); context.put("total_fails", getTotalFails()); context.put("total_skipped", getTotalSkipped()); - context.put("chart_data", XmlChartBuilder.donutChart(getTotalPasses(), getTotalFails(), getTotalSkipped())); + context.put("total_pending", getTotalPending()); + context.put("chart_data", XmlChartBuilder.donutChart(getTotalPasses(), getTotalFails(), getTotalSkipped(), getTotalPending())); context.put("time_stamp", timeStamp()); context.put("total_duration", getTotalDuration()); context.put("jenkins_base", pluginUrlPath); @@ -139,6 +140,7 @@ public class FeatureReportGenerator { context.put("total_passes", getTotalTagPasses()); context.put("total_fails", getTotalTagFails()); context.put("total_skipped", getTotalTagSkipped()); + context.put("total_pending", getTotalTagPending()); context.put("chart_data", XmlChartBuilder.StackedColumnChart(allTags)); context.put("total_duration", getTotalTagDuration()); context.put("time_stamp", timeStamp()); @@ -287,6 +289,10 @@ public class FeatureReportGenerator { return Util.findStatusCount(totalSteps, Util.Status.SKIPPED); } + private int getTotalPending(){ + return Util.findStatusCount(totalSteps, Util.Status.UNDEFINED); + } + private int getTotalTagPasses() { int passes = 0; for (TagObject tag : allTags) { @@ -311,6 +317,14 @@ public class FeatureReportGenerator { return skipped; } + private int getTotalTagPending(){ + int pending = 0; + for (TagObject tag : allTags) { + pending += tag.getNumberOfPending(); + } + return pending; + } + private List getAllStepStatuses() { List steps = new ArrayList(); for (Feature feature : allFeatures) { diff --git a/src/main/java/net/masterthought/jenkins/Runner.java b/src/main/java/net/masterthought/jenkins/Runner.java index ddcb1d9..d89df2c 100644 --- a/src/main/java/net/masterthought/jenkins/Runner.java +++ b/src/main/java/net/masterthought/jenkins/Runner.java @@ -18,8 +18,8 @@ public class Runner { FeatureReportGenerator featureReportGenerator = new FeatureReportGenerator(list,rd,"","7","cucumber-jvm",true,true); featureReportGenerator.generateReports(); - boolean result = featureReportGenerator.getBuildStatus(); - System.out.println("status: " + result); +// boolean result = featureReportGenerator.getBuildStatus(); +// System.out.println("status: " + result); } } diff --git a/src/main/java/net/masterthought/jenkins/TagObject.java b/src/main/java/net/masterthought/jenkins/TagObject.java index 33abd4a..4cf9e47 100644 --- a/src/main/java/net/masterthought/jenkins/TagObject.java +++ b/src/main/java/net/masterthought/jenkins/TagObject.java @@ -75,6 +75,10 @@ public class TagObject { public int getNumberOfSkipped() { return Util.findStatusCount(getStatuses(), Util.Status.SKIPPED); } + + public int getNumberOfPending() { + return Util.findStatusCount(getStatuses(), Util.Status.UNDEFINED); + } private List getStatuses(){ List statuses = new ArrayList(); diff --git a/src/main/java/net/masterthought/jenkins/XmlChartBuilder.java b/src/main/java/net/masterthought/jenkins/XmlChartBuilder.java index 7de5bbc..58e4085 100644 --- a/src/main/java/net/masterthought/jenkins/XmlChartBuilder.java +++ b/src/main/java/net/masterthought/jenkins/XmlChartBuilder.java @@ -4,13 +4,13 @@ import java.util.List; public class XmlChartBuilder { - public static String donutChart(int total_passed, int total_failed, int total_skipped){ + public static String donutChart(int total_passed, int total_failed, int total_skipped, int total_pending){ // I was going to use XMLBuilder to generate the chart - but it's so long and boring and I already have the xml so ..... - return "PassedFailedSkipped" + total_passed + "" + total_failed + "" + total_skipped + "donut88dd11cc113488aaff2500"; + return "PassedFailedSkippedPending" + total_passed + "" + total_failed + "" + total_skipped + "" + total_pending + "donut88dd11cc113488aaffFBB91725000"; } public static String StackedColumnChart(List tagObjectList){ - return ""+generateRowsForColumnChart(tagObjectList)+""+generateColumnsForColumnChart(tagObjectList)+"stacked 3d columnC5D88AD88A8A2DEAEC"; + return ""+generateRowsForColumnChart(tagObjectList)+""+generateColumnsForColumnChart(tagObjectList)+"stacked 3d columnC5D88AD88A8A2DEAECebcc81"; } @@ -39,12 +39,19 @@ public class XmlChartBuilder { } buffer.append(""); buffer.append(""); - buffer.append("Skipped"); - for(TagObject tag : tagObjectList){ - buffer.append(""+tag.getNumberOfSkipped()+""); + buffer.append("Skipped"); + for(TagObject tag : tagObjectList){ + buffer.append(""+tag.getNumberOfSkipped()+""); - } + } buffer.append(""); + buffer.append(""); + buffer.append("Pending"); + for(TagObject tag : tagObjectList){ + buffer.append(""+tag.getNumberOfPending()+""); + + } + buffer.append(""); return buffer.toString(); } diff --git a/src/main/java/net/masterthought/jenkins/json/Feature.java b/src/main/java/net/masterthought/jenkins/json/Feature.java index 292cb3f..dce131b 100644 --- a/src/main/java/net/masterthought/jenkins/json/Feature.java +++ b/src/main/java/net/masterthought/jenkins/json/Feature.java @@ -119,6 +119,10 @@ public class Feature { return Util.findStatusCount(lookUpSteps(), Util.Status.FAILED); } + public int getNumberOfPending(){ + return Util.findStatusCount(lookUpSteps(), Util.Status.UNDEFINED); + } + public int getNumberOfSkipped() { return Util.findStatusCount(lookUpSteps(), Util.Status.SKIPPED); } diff --git a/src/main/resources/templates/featureOverview.vm b/src/main/resources/templates/featureOverview.vm index 5b67ea9..29eccfe 100644 --- a/src/main/resources/templates/featureOverview.vm +++ b/src/main/resources/templates/featureOverview.vm @@ -144,6 +144,7 @@ if (AC_FL_RunContent == 0 || DetectFlashVer == 0) { Passed Failed Skipped + Pending Duration Status @@ -163,6 +164,7 @@ if (AC_FL_RunContent == 0 || DetectFlashVer == 0) { $feature.getNumberOfPasses() $feature.getNumberOfFailures() $feature.getNumberOfSkipped() + $feature.getNumberOfPending() $feature.getDurationOfSteps() $feature.getRawStatus() @@ -175,6 +177,7 @@ if (AC_FL_RunContent == 0 || DetectFlashVer == 0) { $total_passes $total_fails $total_skipped +$total_pending $total_duration Totals diff --git a/src/main/resources/templates/featureReport.vm b/src/main/resources/templates/featureReport.vm index 314a712..5ce2645 100644 --- a/src/main/resources/templates/featureReport.vm +++ b/src/main/resources/templates/featureReport.vm @@ -119,9 +119,10 @@ table.data-table td { Feature Scenarios Steps - Passed - Failed - Skipped + Passed + Failed + Skipped + Pending Duration Status @@ -133,6 +134,7 @@ table.data-table td { $feature.getNumberOfPasses() $feature.getNumberOfFailures() $feature.getNumberOfSkipped() + $feature.getNumberOfPending() $feature.getDurationOfSteps() $feature.getRawStatus() diff --git a/src/main/resources/templates/tagOverview.vm b/src/main/resources/templates/tagOverview.vm index 2d22846..f30733a 100644 --- a/src/main/resources/templates/tagOverview.vm +++ b/src/main/resources/templates/tagOverview.vm @@ -209,6 +209,7 @@ Passed Failed Skipped + Pending Duration Status @@ -230,6 +231,7 @@ $tag.getNumberOfPasses() $tag.getNumberOfFailures() $tag.getNumberOfSkipped() + $tag.getNumberOfPending() $tag.getDurationOfSteps() $tag.getRawStatus() @@ -242,6 +244,7 @@ $total_passes $total_fails $total_skipped + $total_pending $total_duration Totals diff --git a/src/main/resources/templates/tagReport.vm b/src/main/resources/templates/tagReport.vm index 067b4b9..6fc4152 100644 --- a/src/main/resources/templates/tagReport.vm +++ b/src/main/resources/templates/tagReport.vm @@ -119,9 +119,10 @@ table.data-table td { Tag Scenarios Steps - Passed - Failed - Skipped + Passed + Failed + Skipped + Pending Duration Status @@ -133,6 +134,7 @@ table.data-table td { $tag.getNumberOfPasses() $tag.getNumberOfFailures() $tag.getNumberOfSkipped() + $tag.getNumberOfPending() $tag.getDurationOfSteps() $tag.getRawStatus() diff --git a/velocity.log b/velocity.log index 2c8ccdf..e9c325c 100644 --- a/velocity.log +++ b/velocity.log @@ -1,28 +1,28 @@ -Fri May 25 22:39:04 BST 2012 [debug] AvalonLogChute initialized using file 'velocity.log' -Fri May 25 22:39:04 BST 2012 [trace] ******************************************************************* -Fri May 25 22:39:04 BST 2012 [debug] Starting Jakarta Velocity v1.5-SNAPSHOT (compiled: 2006-07-21 06:25:35) -Fri May 25 22:39:04 BST 2012 [trace] RuntimeInstance initializing. -Fri May 25 22:39:04 BST 2012 [debug] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties -Fri May 25 22:39:04 BST 2012 [debug] Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute -Fri May 25 22:39:04 BST 2012 [debug] Using logger class org.apache.velocity.runtime.log.AvalonLogChute -Fri May 25 22:39:04 BST 2012 [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl) -Fri May 25 22:39:04 BST 2012 [debug] ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader -Fri May 25 22:39:04 BST 2012 [trace] ClasspathResourceLoader : initialization complete. -Fri May 25 22:39:04 BST 2012 [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl) -Fri May 25 22:39:04 BST 2012 [trace] Default ResourceManager initialization complete. -Fri May 25 22:39:04 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal -Fri May 25 22:39:04 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro -Fri May 25 22:39:04 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse -Fri May 25 22:39:04 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include -Fri May 25 22:39:04 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach -Fri May 25 22:39:04 BST 2012 [debug] Created '20' parsers. -Fri May 25 22:39:04 BST 2012 [trace] Velocimacro : initialization starting. -Fri May 25 22:39:04 BST 2012 [debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm -Fri May 25 22:39:04 BST 2012 [debug] Velocimacro : Default library not found. -Fri May 25 22:39:04 BST 2012 [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates -Fri May 25 22:39:04 BST 2012 [debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions -Fri May 25 22:39:04 BST 2012 [debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed. -Fri May 25 22:39:04 BST 2012 [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros -Fri May 25 22:39:04 BST 2012 [trace] Velocimacro : initialization complete. -Fri May 25 22:39:04 BST 2012 [trace] RuntimeInstance successfully initialized. -Fri May 25 22:39:04 BST 2012 [debug] ResourceManager : found templates/tagOverview.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader +Sat May 26 08:06:54 BST 2012 [debug] AvalonLogChute initialized using file 'velocity.log' +Sat May 26 08:06:54 BST 2012 [trace] ******************************************************************* +Sat May 26 08:06:54 BST 2012 [debug] Starting Jakarta Velocity v1.5-SNAPSHOT (compiled: 2006-07-21 06:25:35) +Sat May 26 08:06:54 BST 2012 [trace] RuntimeInstance initializing. +Sat May 26 08:06:54 BST 2012 [debug] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties +Sat May 26 08:06:54 BST 2012 [debug] Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute +Sat May 26 08:06:54 BST 2012 [debug] Using logger class org.apache.velocity.runtime.log.AvalonLogChute +Sat May 26 08:06:54 BST 2012 [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl) +Sat May 26 08:06:54 BST 2012 [debug] ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader +Sat May 26 08:06:54 BST 2012 [trace] ClasspathResourceLoader : initialization complete. +Sat May 26 08:06:54 BST 2012 [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl) +Sat May 26 08:06:54 BST 2012 [trace] Default ResourceManager initialization complete. +Sat May 26 08:06:54 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal +Sat May 26 08:06:54 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro +Sat May 26 08:06:54 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse +Sat May 26 08:06:54 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include +Sat May 26 08:06:54 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach +Sat May 26 08:06:54 BST 2012 [debug] Created '20' parsers. +Sat May 26 08:06:54 BST 2012 [trace] Velocimacro : initialization starting. +Sat May 26 08:06:54 BST 2012 [debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm +Sat May 26 08:06:54 BST 2012 [debug] Velocimacro : Default library not found. +Sat May 26 08:06:54 BST 2012 [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates +Sat May 26 08:06:54 BST 2012 [debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions +Sat May 26 08:06:54 BST 2012 [debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed. +Sat May 26 08:06:54 BST 2012 [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros +Sat May 26 08:06:54 BST 2012 [trace] Velocimacro : initialization complete. +Sat May 26 08:06:54 BST 2012 [trace] RuntimeInstance successfully initialized. +Sat May 26 08:06:54 BST 2012 [debug] ResourceManager : found templates/tagOverview.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader