Reputation: 305
I set up Jenkins on my local machine running Ubuntu, pointed it at my jdk, and maven, created a job to run my Selenium tests and gave it the path to the pom.xml in the project, but when I try to run the job, it fails right away. The console output reads
Building in workspace /var/lib/jenkins/workspace/new job [new job] $ /usr/share/maven2/bin/mvn -f /pathto/pom.xml -Dtests=firefox_tests.xml [email protected] must specify at least one goal or lifecycle phase to perform build steps. The following list illustrates some commonly used build commands: mvn clean Deletes any build output (e.g. class files or JARs).mvn test...
I'm just not sure how to proceed. How can I get past this error and get my Selenium tests to run with Jenkins and Maven? Thanks.
Upvotes: 0
Views: 3052
Reputation: 127
Have you hooked the selenium test into the Maven lifecycle?
Normally selenium tests would be executed as part of the integration-test phase, which could be configured with a plugin configuration like below in your pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>${skip.selenium.tests}</skip>
<parallel>none</parallel>
<threadCount>1</threadCount>
<reuseForks>false</reuseForks>
<disableXmlReport>true</disableXmlReport>
</configuration>
<executions>
<execution>
<id>runSeleniumTests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
With this added to your pom (and all Selenium dependencies in place), you should be able to run the selenium tests with
mvn clean integration-test
And that is also the command you should specify in your CI server. Or if it just asks you for goals to execute, choose: 'clean integration-test'
Upvotes: 2
Reputation: 3461
According to your error and output, you are running it as:
mvn -f /pathto/pom.xml -Dtests=firefox_tests.xml [email protected]
So, there is no any goal what to build here. How are you running it manually? Probably forgotten to run as "mvn test -f ..." ?
Upvotes: 1