← Back to Blog

August 19, 2019 · 4 views

How to create jenkins generic runner based on cucumber tags

Testing Automation
How to create jenkins generic runner based on cucumber tags

Today we are going to jump a little bit in CI/CD with a generic jenkins runner based on cucumber tags. In this post will be detailed explained how to configure the runner and how to create the generic profile on real project, let’s start…

Creating maven profile based on failsafe plugin to run CucumberRunner.

The profile will contains the maven-failsafe-plugin to run java test, and how you know the cucumber runners is a simple java test.

In cucumber options we have [CDATA[${tags}]] here we will send tag name with -D options, Let’s consider an example : -Dcucumber.options=”–tags @UI “.

<profile>
  <id>generic-runner</id>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <forkCount>1</forkCount>
          <reuseForks>true</reuseForks>
          <includes>
            <include>**/RunAllTests.java</include>
          </includes>
          <argLine>-Xmx1024m -Dfile.encoding=${project.build.sourceEncoding}</argLine>
          <systemPropertyVariables>
            <cucumber.options><![CDATA[${tags}]]></cucumber.options>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile> After adding the profile the <tags>--tags ~@ignore</tags> parameter should be add in pom.xml property.

Configure jenkins job:

An important part of jenkins job is to start our profile with maven command:

jenkins-conf

In order to run test based on another tag, just change the  @UI tag from following mvn command: clean install -Pgeneric-runner -Dcucumber.options=”–tags @UI “.

Or you can add multiple tags on your jenkins execution. Hope this will help you to improve your testing CI/CD.

Frequently Asked Questions

How can I run specific Cucumber tests in Jenkins?

You can configure a Jenkins job to run specific Cucumber tests by using Maven profiles and passing Cucumber tags (e.g., `@smoke`, `@regression`) as command-line arguments to the build execution.

📚 How to Cite This Article

APA Format:

I enjoy building things that live on the internet. (2019). How to create jenkins generic runner based on cucumber tags. Steti.info. https://steti.info/blog/how-to-create-jenkins-generic-runner-based-on-cucumber-tags

MLA Format:

I enjoy building things that live on the internet. "How to create jenkins generic runner based on cucumber tags." Steti.info, 19 Aug. 2019. https://steti.info/blog/how-to-create-jenkins-generic-runner-based-on-cucumber-tags.

Chicago Style:

I enjoy building things that live on the internet. "How to create jenkins generic runner based on cucumber tags." Steti.info. August 19, 2019. https://steti.info/blog/how-to-create-jenkins-generic-runner-based-on-cucumber-tags.

Published: August 19, 2019
Last Updated: November 29, 2025

About the Author

Author
I like to build from websites to web apps, I create digital experiences that solve real problems and delight users and the most important is that all that I build, I build with PEOPLE!
Learn more about the author →

Related Posts