Forum Discussion

DenGuzawr22's avatar
DenGuzawr22
New Contributor
2 years ago

Cucumber executable jar has undefined scenarios

I try to create an executable jar for my cucumber Kotlin application but it prints in log that all scenarios are undefined:

...
3 Scenarios (3 undefined)
8 Steps (5 skipped, 3 undefined)
...

The application can be executed correctly from command line or from IntelliJ

 

Entry point of program:

package dsdms.client
import io.cucumber.core.cli.Main

class Main{
    companion object{
        @JvmStatic
        fun main(args: Array<String>) {
            Main.main("-p", "pretty",
                "--glue", "dsdms.client.cucumber",
                "--plugin", "html:build/reports/cucumber",
                "SystemTester/src/main/resources/features")
            println("Hello Worldddd2!")

        }
    }
}

 

For project building I use Gradle with Kotlin DSL

 

I tried to use first src/test and then src/main folders but even if I can execute all correctly form console, the jar can't to find the step definitions


For fat jar generation I use:

 

tasks.withType<Jar> {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    manifest {
        attributes["Main-Class"] = "dsdms.client.Main"
    }

    dependsOn(configurations.runtimeClasspath)
    from({
        configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
    })

    destinationDirectory.set(file("$buildDir/output"))
}