DevX
DevX

Reputation: 510

How to run Cucumber JVM Test in Jenkins

I have an Selenium Automation Framework integrated with Maven and Cucumber. I want to run my cucumber test using jenkins.

I am following steps to run it:

  1. Create New Job > Select Maven Project
  2. Provide Path of POM.xml
  3. Add Post Build Action Cucumber-JVM reports
  4. Save
  5. Build Now

The cucumber tests are not running after executing these steps, however Build is successful.

Upvotes: 2

Views: 10128

Answers (2)

snikt
snikt

Reputation: 601

You need the following libraries in your pom.xml, within

<pluginManagement></pluginManagement>

1

  • org.apache.maven.plugins
  • maven-compiler-plugins

2

  • org.apache.maven.plugins
  • maven-surefire-plugin

Build the project again, and then execute at the directory of your pom.xml - "maven clean", "maven test"

Upvotes: 0

A user
A user

Reputation: 1108

Your pom.xml should have runner scripted like below.

Also Goal and options in jenkins should be -Dtest=Runnerclass test incase you are running single test

<profiles>
    <profile>
        <id>integration-tests</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <configuration>
                        <parallel>none</parallel>
                        <threadCount>1</threadCount>
                        <disableXmlReport>true</disableXmlReport>
                    </configuration>
                    <executions>
                        <execution>
                            <id>Runnerclass</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

id in the above plugin is your runner. then you can run your tests in jenkins.

Upvotes: 2

Related Questions