Search code examples
cucumberkaratecucumberjs

Karate tests in other folder than src/test


I want to move Karate tests from src/test to a new folder src/it because it makes sense to me to have integration tests separated from unit tests.

Is that possible?

I tried to put java classes in src/it/java and features in src/it/resources and Karate tests run, but without test cases.

Thanks in advance.


Solution

  • Issue was solved using a Maven plugin to add src/it/java as test sources and src/it/resources as test resources:

                <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <id>add-test-source</id>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/it/java</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-test-resource</id>
                        <goals>
                            <goal>add-test-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/it/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>