简体   繁体   中英

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.

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.

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM