Using parametrized cucumber tags in jenkins

Hello All,

Currently, I run my tests via jenkins with a single “@smoke” tag. The issue i have with this is that the tests take 4 hours to run. I would like to split my tests using several tags. With these different tags, I would like to have the choice to either run all tests or run a specific tag. For example: @Regression

For this, I use the Cucumber runner like this:

@RunWith(Cucumber.class)
@CucumberOptions(
features = "Include/features",
glue="",
plugin=["pretty","html:Reports","json:Reports/cucumber.json", ],
tags = ["@smoke"]
)

class CucumberRunner {
}

I want to add another tag “@Regression” (for now and add more later)

@RunWith(Cucumber.class)
@CucumberOptions(
features = "Include/features",
glue="",
plugin=["pretty","html:Reports","json:Reports/cucumber.json", ],
tags = ["@smoke","@Regression"]
)

class CucumberRunner {
}

On the jenkins side, I use a pipeline with a jenkins file and I use the docker version of katalon with the following command:

"sh ./katalon-boot.sh -a ${env.KATALON_API_KEY} -e ${params.ENV_ENDPOINT}"

I am using the command below in the file katalon-boot.sh

docker run --add-host ......"$(pwd)":/katalon/katalon/source -v /dev/shm:/dev/shm katalonstudio/katalon katalonc.sh -projectPath=/katalon/katalon/source -reportFolder=Reports -reportFileName=report -browserType=Chrome -config -webui.autoUpdateDrivers=true -retry=0 -statusDelay=5 -testSuitePath="Test Suites/CucumberTestSuite" -apiKey=${_apiKey} -executionProfile=${_env}

I want to add a parameter in my jenkins job with a list of choices: @smoke
@Regression and pass this parameter to my command above.

i tried to add at the end of the cammand above this :
-testOps.tag=<tag1, tag2>
found here https://docs.katalon.com/docs/execute/katalon-runtime-engine/command-line-syntax-in-katalon-runtime-engine but it’s not working.

If you have any suggestion I will gladly take it.

I thank you in advance.

MTO

Hello All,
I am waiting for a solution to my issue please. I thank you all :slight_smile:

Hello All,

I finally found a solution for my issue. Here are the steps to follow :

  • Add a global variable in your execution profile. ex : TAGS = “@smoke
  • Create a testcase and add this keyword :
    CucumberKW.runFeatureFolderWithTags('Include/features', GlobalVariable.TAGS)
    Include/features = path to your features files
  • Create a testsuite and add the testcase created above
  • In your jekins job or your jenkinsfile, add parameter with your tags like this :
katalon....-apiKey=xxxxx -executionProfile=xxxx -g_TAGS="@regression"

Everything is working well

1 Like

Awesome @mtouayouch