I’ve some problem with running cucumber tests in docker container. When container started cucumber can’t find steps for all my scenarios.
My pom.xml and assembly.xml for build fat jar with dependencies and tests
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>com.iprody.e2e.CucumberTest</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>fat-tests</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<unpack>true</unpack>
<scope>test</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.directory}/test-classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*.class</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
<directory>src/test/resources</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
</fileSets>
</assembly>
I get the structure of jar file.
enter image description here
My cucumber test class.
public class CucumberTest {
public static void main(String[] args) {
Stream<String> cucumberOptions = Stream.of(args);
io.cucumber.core.cli.Main.main(cucumberOptions.toArray(String[]::new));
}
}
ENTRYPOIND and CMD in dockerfile
ENTRYPOINT ["java", "-jar", "e2e.jar"]
CMD ["--glue", "com.iprody.e2e.steps", "classpath:features"]
When conteiner start, i get this error
Undefined scenarios:
2024-09-05T13:15:34.731997645Z classpath:features/CreateCustomer.feature:3 # Successfully create a new customer
2024-09-05T13:15:34.732236803Z classpath:features/CreateCustomer.feature:16
2024-09-05T13:15:34.732351793Z classpath:features/GetAllCustomers.feature:3
2024-09-05T13:15:34.732443984Z classpath:features/GetCustomerById.feature:3
2024-09-05T13:15:34.732539400Z classpath:features/GetCustomerById.feature:8
2024-09-05T13:15:34.732654281Z classpath:features/LoadApplication.feature:2
2024-09-05T13:15:34.732803959Z classpath:features/UpdateCustomerSteps.feature:3
2024-09-05T13:15:34.733273877Z classpath:features/UpdateCustomerSteps.feature:8
2024-09-05T13:15:34.733297263Z classpath:features/UpdateCustomerSteps.feature:13
2024-09-05T13:15:34.733343246Z classpath:features/UpdateCustomerSteps.feature:18
2024-09-05T13:15:34.733364400Z classpath:features/UpdateCustomerSteps.feature:24
2024-09-05T13:15:34.733393857Z classpath:features/UpdateCustomerSteps.feature:29
2024-09-05T13:15:34.733845368Z classpath:features/UpdateCustomerSteps.feature:34
2024-09-05T13:15:34.733867065Z classpath:features/UpdateCustomerSteps.feature:39
2024-09-05T13:15:34.734061860Z classpath:features/UpdateCustomerSteps.feature:44
2024-09-05T13:15:34.734078839Z classpath:features/UpdateCustomerSteps.feature:49
2024-09-05T13:15:34.734080906Z
2024-09-05T13:15:34.734577029Z 16 Scenarios (16 undefined)
2024-09-05T13:15:34.734796873Z 48 Steps (32 skipped, 16 undefined)
2024-09-05T13:15:34.737678032Z 0m0.110s
What can i do to solve this problem and run cucumber tests?
1