Skip to content

Commit

Permalink
Upgrade to net.masterthought:cucumber-reporting:3.2.0 (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpears201 authored and Trent Schmidt committed Sep 11, 2018
1 parent 58dacae commit f2c9380
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<slf4j.version>1.6.4</slf4j.version>
<logback.version>1.1.2</logback.version>
<cucumber.version>1.2.4</cucumber.version>
<cucumber.reporting.version>0.0.23</cucumber.reporting.version>
<cucumber.reporting.version>3.2.0</cucumber.reporting.version>
<testng.version>6.8.8</testng.version>

<!-- Plugin Versions -->
Expand Down
29 changes: 18 additions & 11 deletions src/main/java/com/comcast/zucchini/ZucchiniShutdownHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,30 @@
*/
package com.comcast.zucchini;

import java.util.List;
import java.util.LinkedList;
import java.util.Properties;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;

import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.JsonArray;

import net.masterthought.cucumber.Configuration;
import net.masterthought.cucumber.ReportBuilder;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.masterthought.cucumber.Reportable;

class ZucchiniShutdownHook extends Thread {

private static final Logger LOGGER = LoggerFactory.getLogger(ZucchiniShutdownHook.class);
private static final String NAME_ENV_VAR = "ZUCCHINI_REPORT_NAME";

public static final org.apache.logging.log4j.Logger NOOP = LogManager.getLogger(ReportBuilder.class); // Workaround: LogManager needs to be statically initialized outside of a shutdown hook
private static ZucchiniShutdownHook instance = null;

public static ZucchiniShutdownHook getDefault() {
Expand Down Expand Up @@ -117,10 +120,14 @@ public void run() {
rptName = System.getenv(NAME_ENV_VAR);


ReportBuilder reportBuilder = new ReportBuilder(pathList, html, "", rptName + version, "Zucchini" + version, true, true, true, false, false, "", false);
reportBuilder.generateReports();
Configuration reportConfig = new Configuration(html, "Zucchini" + version);
reportConfig.setBuildNumber(rptName + version);
ReportBuilder reportBuilder = new ReportBuilder(pathList, reportConfig);
Reportable reportable = reportBuilder.generateReports();
FileUtils.copyDirectory(new File(html, ReportBuilder.BASE_DIRECTORY), html); // move the cucumber base directory into zucchini
FileUtils.deleteDirectory((new File(html, ReportBuilder.BASE_DIRECTORY)));

boolean buildResult = reportBuilder.getBuildStatus();
boolean buildResult = (reportable != null) && reportable.getFailedSteps() == 0;
if(!buildResult)
throw new Exception("BUILD FAILED - Check Report For Details");
}
Expand Down
10 changes: 4 additions & 6 deletions src/test/java/com/comcast/zucchini/FastrunZucchiniCukesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,10 @@ public void cleanup(TestContext out) {
public Iterator<CucumberFeatureHolder> fastrunIteratorFactory(Iterator<CucumberFeature> iterator) {
Iterator<CucumberFeatureHolder> response = super.fastrunIteratorFactory(iterator);

if (null == singleton) {
synchronized (this) {
if (null == singleton) {
singleton = response;
wrapped = new TestIterator<CucumberFeatureHolder>(response);
}
synchronized (this) {
if (null == singleton) {
singleton = response;
wrapped = new TestIterator<CucumberFeatureHolder>(response);
}
}
Assert.assertTrue(singleton == response, "The iterators returned from fastrun should be the same one as it is a singleton");
Expand Down

0 comments on commit f2c9380

Please sign in to comment.