How to run selenium tests using Jenkins / Maven?

I installed Jenkins on my local Ubuntu machine, pointed to my jdk and maven, created a job to run Selenium tests and gave it the path to the pom.xml in the project, but when I try to run the job, it crashes right away. The console output reads

Building in workspace / var / lib / jenkins / workspace / new work [new job] $ / usr / share / maven2 / bin / mvn -f / pathto / pom.xml -Dtests = firefox_tests.xml -Dreceiver = myemail @ myemail .com ... You must specify at least one goal or lifecycle phase to complete the build steps. The following list illustrates some of the commonly used build commands: mvn clean Removes any build output (such as class files or JARs). Mvn test ...

I just don't know how to proceed. How can I get past this error and get Selenium tests to work with Jenkins and Maven? Thank.

0


source to share


2 answers


Have you hooked up your selenium test to the Maven lifecycle?

Typically selenium tests will run as part of the integration-test phase, which can be configured with the plugin config as shown 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 addition to your pom (and all Selenium dependencies in place), you should be able to run your selenium tests with

mvn clean integration-test

      

And this is also the command that you must specify in your CI server. Or, if it just asks you to complete the goals, select: "clean integration-test"

+2


source


According to your errors and findings, you run it like:

mvn -f /pathto/pom.xml -Dtests=firefox_tests.xml -Dreceiver=myemail@myemail.com

      



So there is no purpose of what to build here. How do you start it manually? Perhaps you forgot to run "mvn test -f ..."?

+1


source







All Articles