Unable to execute cucumber tests as jar file

26 views Asked by At

I have a project with cucumber tests for regression. My requirement is build a fat jar out of project and run the tests using the java -jar.. I used maven-assembly-plugin to generate a fat jar with all the dependencies included in the jar file. My pom.xml is as below

 <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>io.cucumber.core.cli.Main</mainClass>
                    </manifest>
                    <manifestEntries>
                        <Class-Path>.</Class-Path>
                    </manifestEntries>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

After this i am running the executable as java -cp target/regression-test-1.0.40-jar-with-dependencies.jar io.cucumber.core.cli.Main --glue classpath:/au/com/core/api/stepdefs/createtransactionreport classpath:/features

However, it fails with missing step definitions files and asks me to implement the steps.

io.cucumber.junit.UndefinedStepException: The step 'I want to get report status for "notfound"' and 4 other step(s) are undefined.
You can implement these steps using the snippet(s) below:

Given("I want to get report status for {string}", (String string) -> {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java8.PendingException();
});

When("I provide correlationId {string}", (String string) -> {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java8.PendingException();
});

Any ideas what i may be doing wrong. Request your help in this regard. Thanks in advance. Raghu

0

There are 0 answers