Skip to content

Commit

Permalink
Release 6.15.0 (#411)
Browse files Browse the repository at this point in the history
* Prepare release 6.15.0
  • Loading branch information
prashant-ramcharan authored Jul 20, 2024
1 parent e11702b commit 53e09ac
Show file tree
Hide file tree
Showing 25 changed files with 624 additions and 486 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
arguments: build -x signArchives
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
CHANGES IN VERSION 6.15.0
=================================
* [IMPROVEMENT] Re-implement reporting processing to improve performance and reduce memory usage.
* [IMPROVEMENT] Various code changes and improvements to the core runtime.
* [NEW] Create a `courgette-report-processing-errors.txt` file if there are any report processing errors.


CHANGES IN VERSION 6.14.0
=================================
* [ENHANCEMENT] Add support for running tests inside a FAT jar that uses a classpath to locate feature files (bundled in JAR)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ Courgette-JVM is an extension of Cucumber-JVM with added capabilities to **run c
<dependency>
<groupId>io.github.prashant-ramcharan</groupId>
<artifactId>courgette-jvm</artifactId>
<version>6.14.0</version>
<version>6.15.0</version>
</dependency>
````

#### Gradle
````gradle
implementation group: 'io.github.prashant-ramcharan', name: 'courgette-jvm', version: '6.14.0'
implementation group: 'io.github.prashant-ramcharan', name: 'courgette-jvm', version: '6.15.0'
````

#### Included Cucumber Dependencies
Expand Down
62 changes: 60 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
group 'io.github.prashant-ramcharan'
version '6.14.0'
version '6.15.0'

apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'signing'

compileJava {
sourceCompatibility = 1.8
Expand Down Expand Up @@ -46,8 +48,18 @@ task buildJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives buildJar
archives buildJar, javadocJar, sourcesJar
}

jar {
Expand All @@ -64,3 +76,49 @@ publishing {
}
}
}

signing {
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'Courgette JVM'
packaging 'jar'
description 'Multi-threaded | Parallel Cucumber-JVM | Parallelize your Java Cucumber tests on a feature level or on a scenario level.'
url 'https://github.com/prashant-ramcharan/courgette-jvm'

scm {
url 'https://github.com/prashant-ramcharan/courgette-jvm'
}

licenses {
license {
name 'MIT License'
url 'https://opensource.org/licenses/MIT'
}
}

developers {
developer {
id 'prashant-ramcharan'
name 'Prashant Ramcharan'
email '[email protected]'
}
}
}
}
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ossrhUsername=
ossrhPassword=
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 1 addition & 6 deletions src/main/java/courgette/api/junit/Courgette.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.util.List;
import java.util.Map;

import static courgette.runtime.CourgetteException.printError;

public class Courgette extends CourgetteJUnitRunner {

public Courgette(Class clazz) throws InitializationError {
Expand Down Expand Up @@ -61,12 +59,10 @@ public void run(RunNotifier notifier) {
case OK:
courgetteRunner.createCucumberReport();
courgetteRunner.createCourgetteReport();
courgetteRunner.createErrorReport();
courgetteRunner.createCourgettePluginReports();
courgetteRunner.createCourgetteRunLogFile();
break;
case REPORT_PROCESSING_ERROR:
printError("[Courgette Runner] There was an unexpected error processing the individual Cucumber report files and Courgette was unable to create any reports for this test run.");
break;
case ERROR:
CourgetteTestErrorException.throwTestErrorException();
}
Expand All @@ -79,7 +75,6 @@ public void run(RunNotifier notifier) {
} finally {
courgetteRunner.printCourgetteTestStatistics();
courgetteRunner.printCourgetteTestFailures();
courgetteRunner.cleanupCourgetteHtmlReportFiles();
callbacks.afterAll();
notifyTestStarted(notifier);
notifyTestFailure(notifier, failures);
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/courgette/api/testng/TestNGCourgette.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import java.util.List;
import java.util.Map;

import static courgette.runtime.CourgetteException.printError;

public abstract class TestNGCourgette {
private CourgetteProperties courgetteProperties;
private List<CourgetteRunnerInfo> runnerInfoList;
Expand Down Expand Up @@ -54,12 +52,10 @@ public void parallelRun() {
case OK:
courgetteRunner.createCucumberReport();
courgetteRunner.createCourgetteReport();
courgetteRunner.createErrorReport();
courgetteRunner.createCourgettePluginReports();
courgetteRunner.createCourgetteRunLogFile();
break;
case REPORT_PROCESSING_ERROR:
printError("[Courgette Runner] There was an unexpected error processing the individual Cucumber report files and Courgette was unable to create any reports for this test run.");
break;
case ERROR:
CourgetteTestErrorException.throwTestErrorException();
}
Expand All @@ -72,7 +68,6 @@ public void parallelRun() {
} finally {
courgetteRunner.printCourgetteTestStatistics();
courgetteRunner.printCourgetteTestFailures();
courgetteRunner.cleanupCourgetteHtmlReportFiles();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ public void addTest(CourgetteRunnerInfo runnerInfo) {
return;
}

final List<courgette.runtime.report.model.Feature> features = JsonReportParser
.create(reportFile, courgetteProperties.getCourgetteOptions().runLevel())
.getReportFeatures();
final JsonReportParser jsonReportParser = new JsonReportParser(reportFile.getPath(), courgetteProperties.isFeatureRunLevel());
jsonReportParser.createFeatures();

final List<courgette.runtime.report.model.Feature> features = jsonReportParser.getFeatures();

List<Scenario> scenarios = features.stream()
.flatMap(feature -> feature.getScenarios().stream())
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/courgette/runtime/CourgetteException.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public static void printExceptionStackTrace(Exception e) {
e.printStackTrace();
}

public static void printExceptionStackTrace(Throwable e) {
e.printStackTrace();
}

public static void printError(String error) {
System.err.println(error);
}
Expand Down
17 changes: 5 additions & 12 deletions src/main/java/courgette/runtime/CourgetteNdJsonCreator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package courgette.runtime;

import io.cucumber.core.gherkin.Feature;
import io.cucumber.messages.NdjsonToMessageIterable;
import io.cucumber.messages.types.Envelope;
import io.cucumber.messages.types.FeatureChild;
Expand All @@ -25,15 +24,13 @@
import java.util.function.Predicate;
import java.util.stream.Collectors;

import static courgette.runtime.CourgetteException.printExceptionStackTrace;
import static courgette.runtime.utils.JacksonUtils.CUCUMBER_OBJECT_MAPPER;
import static java.util.Comparator.comparingLong;

public class CourgetteNdJsonCreator {
private final Map<String, List<List<Envelope>>> messages;

private final Map<Feature, List<List<Envelope>>> messages;

public CourgetteNdJsonCreator(Map<Feature, List<List<Envelope>>> messages) {
public CourgetteNdJsonCreator(Map<String, List<List<Envelope>>> messages) {
this.messages = messages;
}

Expand All @@ -43,13 +40,9 @@ public static List<Envelope> createMessages(String source) {
final List<Envelope> messages = new ArrayList<>(messageList.size());

messageList.forEach(message -> {
try {
ByteArrayInputStream in = new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8));
for (Envelope envelope : new NdjsonToMessageIterable(in, new NdJsonMessageDeserializer())) {
messages.add(envelope);
}
} catch (Exception e) {
printExceptionStackTrace(e);
ByteArrayInputStream in = new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8));
for (Envelope envelope : new NdjsonToMessageIterable(in, new NdJsonMessageDeserializer())) {
messages.add(envelope);
}
});
return messages;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/courgette/runtime/CourgetteProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public boolean isCucumberHtmlReportEnabled() {
return checkIfReportIsEnabled.test(HtmlReport.CUCUMBER_HTML);
}

public boolean isCucumberXmlReportPluginEnabled() {
return Arrays.stream(courgetteOptions.cucumberOptions().plugin()).anyMatch(plugin -> plugin.startsWith("junit"));
}

public boolean shouldPersistCucumberJsonReports() {
return courgetteOptions.persistParallelCucumberJsonReports();
}
Expand Down
62 changes: 62 additions & 0 deletions src/main/java/courgette/runtime/CourgetteReportOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package courgette.runtime;

import courgette.runtime.utils.FileUtils;
import io.cucumber.core.gherkin.Feature;

import java.util.Arrays;
import java.util.Optional;

public class CourgetteReportOptions {
private final Feature feature;
private final String jsonFile;
private final String ndjsonFile;
private Optional<String> xmlFile = Optional.empty();
private Optional<String> rerunFile = Optional.empty();

public CourgetteReportOptions(Feature feature, Integer lineId, CourgetteProperties courgetteProperties) {
this.feature = feature;

final String fileId = FileUtils.tempDirectory() + createFeatureIdWithLine(lineId) + courgetteProperties.getSessionId();

jsonFile = fileId + ".json";
ndjsonFile = fileId + ".ndjson";

if (courgetteProperties.isCucumberXmlReportPluginEnabled() || courgetteProperties.isReportPortalPluginEnabled()) {
xmlFile = Optional.of(fileId + ".xml");
}

if (courgetteProperties.getCourgetteOptions().rerunFailedScenarios()) {
rerunFile = Optional.of(fileId + ".txt");
}
}

public Feature getFeature() {
return feature;
}

public String getJsonFile() {
return jsonFile;
}

public String getNdJsonFile() {
return ndjsonFile;
}

public Optional<String> getXmlFile() {
return xmlFile;
}

public Optional<String> getRerunFile() {
return rerunFile;
}

public String getFeatureId() {
return Arrays.stream(feature.getUri().getPath().split("/")).reduce((x, y) -> y)
.orElse("").replace(".feature", "")
.toLowerCase();
}

private String createFeatureIdWithLine(Integer lineId) {
return getFeatureId() + "_" + (lineId == null ? "" : (lineId + "_"));
}
}
Loading

0 comments on commit 53e09ac

Please sign in to comment.