Fixed config values not being retained and added path to specify plugin url
This commit is contained in:
parent
45327f377f
commit
ff1f41ee01
|
@ -1,5 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="gwt" name="GWT">
|
||||||
|
<configuration />
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
@ -10,8 +15,11 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target/classes" />
|
<excludeFolder url="file://$MODULE_DIR$/target/classes" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target/cucumber-reports" />
|
<excludeFolder url="file://$MODULE_DIR$/target/cucumber-reports" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target/generated-sources/groovy-stubs" />
|
<excludeFolder url="file://$MODULE_DIR$/target/generated-sources/groovy-stubs" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target/inject-tests" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target/jenkins-for-test" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target/surefire" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target/surefire-reports" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
|
<excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target/work" />
|
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
@ -78,6 +86,7 @@
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: jfree:jfreechart:1.0.9" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: jfree:jfreechart:1.0.9" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: jfree:jcommon:1.0.12" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: jfree:jcommon:1.0.12" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.ant:ant:1.8.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.ant:ant:1.8.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.ant:ant-launcher:1.8.0" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-digester:commons-digester:1.7" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-digester:commons-digester:1.7" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.mail:mail:1.4" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.mail:mail:1.4" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:activation:1.1.1-hudson-1" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:activation:1.1.1-hudson-1" level="project" />
|
||||||
|
@ -92,7 +101,6 @@
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-dao:1.2.9" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-dao:1.2.9" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-context:2.5" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-context:2.5" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.groovy:groovy-all:1.6.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.groovy:groovy-all:1.6.0" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.ant:ant-launcher:1.7.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: jline:jline:0.9.94" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: jline:jline:0.9.94" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-web:2.5" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-web:2.5" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<groupId>net.masterthought.jenkins</groupId>
|
<groupId>net.masterthought.jenkins</groupId>
|
||||||
<artifactId>cucumber-reports</artifactId>
|
<artifactId>cucumber-reports</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>0.0.1</version>
|
||||||
<packaging>hpi</packaging>
|
<packaging>hpi</packaging>
|
||||||
|
|
||||||
<!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
|
<!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
|
||||||
|
|
|
@ -23,11 +23,13 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class CucumberReportPublisher extends Recorder {
|
public class CucumberReportPublisher extends Recorder {
|
||||||
|
|
||||||
private final String jsonReportDirectory;
|
public final String jsonReportDirectory;
|
||||||
|
public final String pluginUrlPath;
|
||||||
|
|
||||||
@DataBoundConstructor
|
@DataBoundConstructor
|
||||||
public CucumberReportPublisher(String jsonReportDirectory) {
|
public CucumberReportPublisher(String jsonReportDirectory, String pluginUrlPath) {
|
||||||
this.jsonReportDirectory = jsonReportDirectory;
|
this.jsonReportDirectory = jsonReportDirectory;
|
||||||
|
this.pluginUrlPath = pluginUrlPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] findJsonFiles(File targetDirectory) {
|
private String[] findJsonFiles(File targetDirectory) {
|
||||||
|
@ -65,7 +67,7 @@ public class CucumberReportPublisher extends Recorder {
|
||||||
String[] jsonReportFiles = findJsonFiles(targetBuildDirectory);
|
String[] jsonReportFiles = findJsonFiles(targetBuildDirectory);
|
||||||
for (String file : jsonReportFiles) {
|
for (String file : jsonReportFiles) {
|
||||||
listener.getLogger().println("[CucumberReportPublisher] Generating HTML reports based on: " + file);
|
listener.getLogger().println("[CucumberReportPublisher] Generating HTML reports based on: " + file);
|
||||||
SingleResultParser singleResultParser = new SingleResultParser(new File(targetBuildDirectory, file).getAbsolutePath(), targetBuildDirectory, buildNumber, buildProject);
|
SingleResultParser singleResultParser = new SingleResultParser(new File(targetBuildDirectory, file).getAbsolutePath(), targetBuildDirectory, pluginUrlPath, buildNumber, buildProject);
|
||||||
try {
|
try {
|
||||||
singleResultParser.generateReports();
|
singleResultParser.generateReports();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -20,13 +20,15 @@ public class SingleResultParser {
|
||||||
private String buildNumber;
|
private String buildNumber;
|
||||||
private String buildProject;
|
private String buildProject;
|
||||||
private List<Util.Status> totalSteps;
|
private List<Util.Status> totalSteps;
|
||||||
|
private String pluginUrlPath;
|
||||||
|
|
||||||
public SingleResultParser(String jsonResultFile, File reportDirectory, String buildNumber, String buildProject) throws IOException {
|
public SingleResultParser(String jsonResultFile, File reportDirectory, String pluginUrlPath, String buildNumber, String buildProject) throws IOException {
|
||||||
this.featureList = parseJson(jsonResultFile);
|
this.featureList = parseJson(jsonResultFile);
|
||||||
this.totalSteps = getAllStepStatuses();
|
this.totalSteps = getAllStepStatuses();
|
||||||
this.reportDirectory = reportDirectory;
|
this.reportDirectory = reportDirectory;
|
||||||
this.buildNumber = buildNumber;
|
this.buildNumber = buildNumber;
|
||||||
this.buildProject = buildProject;
|
this.buildProject = buildProject;
|
||||||
|
this.pluginUrlPath = getPluginUrlPath(pluginUrlPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateReports() throws Exception {
|
public void generateReports() throws Exception {
|
||||||
|
@ -50,10 +52,32 @@ public class SingleResultParser {
|
||||||
context.put("total_skipped", getTotalSkipped());
|
context.put("total_skipped", getTotalSkipped());
|
||||||
context.put("chart_data", XmlChartBuilder.donutChart(getTotalPasses(), getTotalFails(), getTotalSkipped()));
|
context.put("chart_data", XmlChartBuilder.donutChart(getTotalPasses(), getTotalFails(), getTotalSkipped()));
|
||||||
context.put("time_stamp", timeStamp());
|
context.put("time_stamp", timeStamp());
|
||||||
|
context.put("jenkins_base", pluginUrlPath);
|
||||||
generateReport("feature-overview.html", featureOverview, context);
|
generateReport("feature-overview.html", featureOverview, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void generateFeatureReports() throws Exception {
|
||||||
|
for (Feature feature : featureList) {
|
||||||
|
VelocityEngine ve = new VelocityEngine();
|
||||||
|
ve.init(getProperties());
|
||||||
|
Template featureResult = ve.getTemplate("templates/featureReport.vm");
|
||||||
|
VelocityContext context = new VelocityContext();
|
||||||
|
context.put("feature", feature);
|
||||||
|
context.put("report_status_colour", getReportStatusColour(feature));
|
||||||
|
context.put("build_project", buildProject);
|
||||||
|
context.put("build_number", buildNumber);
|
||||||
|
context.put("scenarios", feature.getElements());
|
||||||
|
context.put("time_stamp", timeStamp());
|
||||||
|
context.put("jenkins_base", pluginUrlPath);
|
||||||
|
generateReport(feature.getFileName(), featureResult, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getPluginUrlPath(String path){
|
||||||
|
return path.isEmpty() ? "/" : path;
|
||||||
|
}
|
||||||
|
|
||||||
private int getTotalSteps() {
|
private int getTotalSteps() {
|
||||||
return totalSteps.size();
|
return totalSteps.size();
|
||||||
}
|
}
|
||||||
|
@ -94,22 +118,6 @@ public class SingleResultParser {
|
||||||
return scenarios;
|
return scenarios;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateFeatureReports() throws Exception {
|
|
||||||
for (Feature feature : featureList) {
|
|
||||||
VelocityEngine ve = new VelocityEngine();
|
|
||||||
ve.init(getProperties());
|
|
||||||
Template featureResult = ve.getTemplate("templates/featureReport.vm");
|
|
||||||
VelocityContext context = new VelocityContext();
|
|
||||||
context.put("feature", feature);
|
|
||||||
context.put("report_status_colour", getReportStatusColour(feature));
|
|
||||||
context.put("build_project", buildProject);
|
|
||||||
context.put("build_number", buildNumber);
|
|
||||||
context.put("scenarios", feature.getElements());
|
|
||||||
context.put("time_stamp", timeStamp());
|
|
||||||
generateReport(feature.getFileName(), featureResult, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateReport(String fileName, Template featureResult, VelocityContext context) throws Exception {
|
private void generateReport(String fileName, Template featureResult, VelocityContext context) throws Exception {
|
||||||
Writer writer = new FileWriter(new File(reportDirectory, fileName));
|
Writer writer = new FileWriter(new File(reportDirectory, fileName));
|
||||||
featureResult.merge(context, writer);
|
featureResult.merge(context, writer);
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
-->
|
-->
|
||||||
<f:entry title="Json Reports Path" field="jsonReportDirectory" description="The path relative to the workspace of the json reports generated by cucumber-jvm e.g. target/cucumber">
|
<f:entry title="Json Reports Path" field="jsonReportDirectory" description="The path relative to the workspace of the json reports generated by cucumber-jvm e.g. target/cucumber">
|
||||||
<f:textbox />
|
<f:textbox />
|
||||||
|
</f:entry>
|
||||||
|
<f:entry title="Plugin Url Path" field="pluginUrlPath" description="The path to the jenkins user content url e.g. http://host:port[/jenkins/]plugin - leave empty if jenkins url root is host:port">
|
||||||
|
<f:textbox />
|
||||||
</f:entry>
|
</f:entry>
|
||||||
</j:jelly>
|
</j:jelly>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<script language="javascript">AC_FL_RunContent = 0;</script>
|
<script language="javascript">AC_FL_RunContent = 0;</script>
|
||||||
<script language="javascript"> DetectFlashVer = 0; </script>
|
<script language="javascript"> DetectFlashVer = 0; </script>
|
||||||
<script src="/plugin/cucumber-reports/charts/AC_RunActiveContent.js" language="javascript"></script>
|
<script src="${jenkins_base}plugin/cucumber-reports/charts/AC_RunActiveContent.js" language="javascript"></script>
|
||||||
<script language="JavaScript" type="text/javascript">
|
<script language="JavaScript" type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
var requiredMajorVersion = 10;
|
var requiredMajorVersion = 10;
|
||||||
|
@ -13,12 +13,12 @@ var requiredRevision = 45;
|
||||||
</script>
|
</script>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<title>Cucumber-JVM Html Reports - Feature Overview</title>
|
<title>Cucumber-JVM Html Reports - Feature Overview</title>
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/style.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/style.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/skin/style.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/skin/style.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/960.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/960.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/reset.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/reset.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/text.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/text.css" type="text/css" media="screen" />
|
||||||
<link rel="shortcut icon" href="/plugin/cucumber-reports/blue/favicon.ico" />
|
<link rel="shortcut icon" href="${jenkins_base}plugin/cucumber-reports/blue/favicon.ico" />
|
||||||
<style>
|
<style>
|
||||||
.feature-keyword{font-weight:bold;}
|
.feature-keyword{font-weight:bold;}
|
||||||
.feature-description{padding-left:15px;font-style:italic;background-color:beige;}
|
.feature-description{padding-left:15px;font-style:italic;background-color:beige;}
|
||||||
|
@ -71,7 +71,7 @@ table.stats-table td {
|
||||||
<h1 class="grid_4 logo"><a href="feature-overview.html" class='ie6fix'>Cucumber</a></h1>
|
<h1 class="grid_4 logo"><a href="feature-overview.html" class='ie6fix'>Cucumber</a></h1>
|
||||||
<div class="grid_6" id="nav">
|
<div class="grid_6" id="nav">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/job/$build_project/$build_number">Back To Jenkins</a></li>
|
<li><a href="${jenkins_base}job/$build_project/$build_number">Back To Jenkins</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,9 +102,9 @@ if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
|
||||||
'salign', 'TL',
|
'salign', 'TL',
|
||||||
'bgcolor', '#bbccff',
|
'bgcolor', '#bbccff',
|
||||||
'wmode', 'opaque',
|
'wmode', 'opaque',
|
||||||
'movie', '/plugin/cucumber-reports/charts/charts',
|
'movie', '${jenkins_base}plugin/cucumber-reports/charts/charts',
|
||||||
'src', '/plugin/cucumber-reports/charts/charts',
|
'src', '${jenkins_base}plugin/cucumber-reports/charts/charts',
|
||||||
'FlashVars', "library_path=/plugin/cucumber-reports/charts/charts_library&xml_data=$chart_data",
|
'FlashVars', "library_path=${jenkins_base}plugin/cucumber-reports/charts/charts_library&xml_data=$chart_data",
|
||||||
'id', 'my_chart',
|
'id', 'my_chart',
|
||||||
'name', 'my_chart',
|
'name', 'my_chart',
|
||||||
'menu', 'true',
|
'menu', 'true',
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<title>Cucumber-JVM Html Reports - Feature: $feature.getRawName() </title>
|
<title>Cucumber-JVM Html Reports - Feature: $feature.getRawName() </title>
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/style.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/style.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/skin/style.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/skin/style.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/960.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/960.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/reset.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/reset.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="/plugin/cucumber-reports/blue/css/text.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="${jenkins_base}plugin/cucumber-reports/blue/css/text.css" type="text/css" media="screen" />
|
||||||
<link rel="shortcut icon" href="/plugin/cucumber-reports/blue/favicon.ico" />
|
<link rel="shortcut icon" href="${jenkins_base}plugin/cucumber-reports/blue/favicon.ico" />
|
||||||
<style>
|
<style>
|
||||||
.feature-keyword{font-weight:bold;}
|
.feature-keyword{font-weight:bold;}
|
||||||
.feature-description{padding-left:15px;font-style:italic;background-color:beige;}
|
.feature-description{padding-left:15px;font-style:italic;background-color:beige;}
|
||||||
|
@ -61,7 +61,7 @@ background-color: white;
|
||||||
<h1 class="grid_4 logo"><a href="feature-overview.html" class='ie6fix'>Cucumber</a></h1>
|
<h1 class="grid_4 logo"><a href="feature-overview.html" class='ie6fix'>Cucumber</a></h1>
|
||||||
<div class="grid_6" id="nav">
|
<div class="grid_6" id="nav">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/job/$build_project/$build_number">Back To Jenkins</a></li>
|
<li><a href="${jenkins_base}job/$build_project/$build_number">Back To Jenkins</a></li>
|
||||||
<li><a href="feature-overview.html">Back To Overview</a></li>
|
<li><a href="feature-overview.html">Back To Overview</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue