Reputation: 31
I have multiple projects using similar step definition across the different projects. Hence using all step definition in single project and added as dependency jar in maven. When I run using maven command it says :
You can implement missing steps with the snippets below:
@When("^Import a canvas from \"(.*?)\" to project \"(.*?)\"$")
public void import_a_canvas_from_to_project(String arg1, String arg2) throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
but when I add package in same project it works fine. (Even in eclipse from different projects works). Is there any way to run such scenarios from maven and jenkins?
I am using eclipse IDE. maven command I used is : mvn -DprofileTest=cucumberID clean -P cucumberID test
cucumberID is my profile name.
Following profile I added in pom.xml
<profile>
<id>cucumberID</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>2.11</version>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<includes>
<include>step_definitions/LoginTest.java</include>
</includes>
<parallel>classes</parallel>
<threadCount>3</threadCount>
<useFile>true</useFile>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Upvotes: 3
Views: 4872
Reputation: 377
If you will use Maven's preferred way of creating packages, then "mvn package" your code, and "mvn install" this package, then you'll be able to run test from external library without changes in class annotated with @CucumberOptions
.
Upvotes: 0
Reputation: 291
use classpath: prefix for the package name to solve this.
for example:
@CucumberOptions(glue = { "classpath:com.example.test.steps" })
Upvotes: 2
Reputation: 6900
You haven't specified how are you running your test suite but assuming that you have @CucumberOptions
somewhere, you can just point to other projects packages like this:
@CucumberOptions(. . . glue = {
"com.company.test.package1", "com.company2.test.package2", . . .})
Upvotes: 5