tsundberg / gradle-cucumber-runner

A gradle plugin for running Cucumber-JVM
Apache License 2.0
20 stars 10 forks source link

Add parent sourceSet #1

Closed kmaterka closed 3 years ago

kmaterka commented 4 years ago

Currently I'm using commercehub-oss/gradle-cucumber-jvm-plugin. Unfortunately it is unmaintained and does not support Gradle6+. I forked it, fixed and published, but I'm still waiting for an approval.

gradle-cucumber-jvm-plugin has nice feature - it can create source set automatically and use it to run cucumber tests. This way cucumber tests are separated from unit tests. I can add source set manually but I can't use it with your plugin.

Can you add new parameter, something like parentSourceSet in the extension? Then change sourceSet lookup in CucumberTask:

for (SourceSet sourceSet : sourceSets) {
    if (extension.parentSourceSet.equals(sourceSet.getName())) {
        return sourceSet.getRuntimeClasspath().getAsPath();
    }
}

or using streams:

  private String getClasspath() {
    SourceSetContainer sourceSets = getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets();

    return sourceSets.stream()
        .filter(sourceSet -> sourceSet.getName().equals(extension.parentSourceSet)).findFirst()
        .map(sourceSet -> sourceSet.getRuntimeClasspath().getAsPath())
        .orElseThrow(() -> {
              throw new RuntimeException("The test classpath was not found");
            }
        );
  }

Do you accept pull requests?

tsundberg commented 4 years ago

Hi,

I do accept pull requests and I would happily add things needed.

I’m not in a position where I can implement your suggestions fast. Work and life restricts me a bit at the moment. Therefore, please send a PR that I can add and then publish a new version.

Cheers, Thomas

On Thu, 21 Nov 2019 at 12:36, Konrad Materka notifications@github.com wrote:

Currently I'm using commercehub-oss/gradle-cucumber-jvm-plugin https://github.com/commercehub-oss/gradle-cucumber-jvm-plugin. Unfortunately it is unmaintained and does not support Gradle6+. I forked https://github.com/kmaterka/gradle-cucumber-jvm-plugin it, fixed and published https://plugins.gradle.org/plugin/cucumber.cucumber-jvm, but I'm still waiting for an approval.

gradle-cucumber-jvm-plugin has nice feature - it can create source set automatically and use it to run cucumber tests. This way cucumber tests are separated from unit tests. I can add source set manually but I can't use it with your plugin.

Can you add new parameter, something like parentSourceSet in the extension? Then change sourceSet lookup in CucumberTask:

for (SourceSet sourceSet : sourceSets) { if (extension.parentSourceSet.equals(sourceSet.getName())) { return sourceSet.getRuntimeClasspath().getAsPath(); } }

or using streams:

private String getClasspath() { SourceSetContainer sourceSets = getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets();

return sourceSets.stream()
    .filter(sourceSet -> sourceSet.getName().equals("test")).findFirst()
    .map(sourceSet -> sourceSet.getRuntimeClasspath().getAsPath())
    .orElseThrow(() -> {
          throw new RuntimeException("The test classpath was not found");
        }
    );

}

Do you accept pull requests?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tsundberg/gradle-cucumber-runner/issues/1?email_source=notifications&email_token=AAEEJEDQLS6QHPOLIT3E4KDQUZXFVA5CNFSM4JQA7W5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3CLCMQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEEJEGQZRGRV44MIN3SEDTQUZXFVANCNFSM4JQA7W5A .

-- Thomas Sundberg M. Sc. in Computer Science

Mobile: +46 70 767 33 15 Twitter: @thomassundberg

http://www.thinkcode.se/

Definition of done: Working software, in production.

sheamunion commented 4 years ago

@kmaterka great suggestion! I'm in the same situation and would love a good replacement to the commercehub-oss/gradle-cucumber-jvm-plugin

kmaterka commented 4 years ago

@sheamunion There is a working fork: https://github.com/double16/gradle-cucumber-jvm-plugin It's is not maintained by me, by I've sent several fixes and improvements that were accepted.

tsundberg commented 4 years ago

I still accept pull request for those interested to contribute.

tsundberg commented 3 years ago

No response for a year - closing