[Cucumber] Run with Cucumber Runner

@m.sivakrishna

You need to import: com.cucumber.testrunner package in the test case script.

import com.cucumber.testrunner

Thank You, Compilation error is gone but unable to run it and getting below error.

Test Cases/BDDTests/CucumberTC FAILED.
Reason:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/C:/Users/msivakrishna/Katalon%20Studio/DemoTest/Scripts/BDDTests/CucumberTC/Script1583939058141.groovy: 17: unable to resolve class com.cucumber.CucumberRunner
@ line 17, column 1.
import com.cucumber.CucumberRunner
^

1 error

at com.kms.katalon.core.main.ScriptEngine.getScript(ScriptEngine.java:199)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1584010286837.run(TempTestCase1584010286837.groovy:23)

Kindly help me on this

You need to import:

import com.cucumber.testrunner.CucumberRunner

or press Ctrl + Shift + O on your test script

Wonderful, Thank you so much for your help.

how can we add tags attribute in Cucumber runner, Could you please suggest. Please find the code I am using but getting error at tags attribute.

package com.cucumber.testrunner
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testcase.TestCaseFactory
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testdata.TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable

import org.openqa.selenium.WebElement
import org.openqa.selenium.WebDriver
import org.openqa.selenium.By

import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import com.kms.katalon.core.webui.driver.DriverFactory

import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObjectProperty

import com.kms.katalon.core.mobile.helper.MobileElementCommonHelper
import com.kms.katalon.core.util.KeywordUtil

import com.kms.katalon.core.webui.exception.WebElementNotFoundException

import cucumber.api.java.en.And
import cucumber.api.java.en.Given
import cucumber.api.java.en.Then
import cucumber.api.java.en.When

import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features=“Include/features”, glue="", tags={"@login","@Products"} plugin = [“pretty”,
“junit:Reports/cucumber.xml”,
“html:Reports”,
“json:Reports/cucumber.json”])

public class CucumberRunner {
}

Could you please reply

Hi, is there any way to generate reports using Serenity BDD? By doing @RunWith(CucumberWithSerenity.class)?

I’ve added the depencies using gradle but I’m still getting some errors.

I’m facing issue with running the feature file with cucumber runner. The feature file is executed fine by using test suite. I’m following the docs instructions of simple example #1 to create a cucumber runner, but the execution failed. Thank you for any help:

04-29-2020 02:21:22 PM Test Cases/operations/MyRunner

Elapsed time: 0,676s

Test Cases/operations/MyRunner FAILED.
Reason:
java.lang.IllegalArgumentException: argument type mismatch
at MyRunner.run(MyRunner:18)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1588162880073.run(TempTestCase1588162880073.groovy:25)

@m.sivakrishna I faced the same issue with exactly the same errors. My problem was that when I created the CucumberRunner class it had groovy extension not java. Make sure that you create the class as a new java class

hello, is there a way to pass other properties than glue such as threads for example ?

I would like to emit this type of cucumber test :

java -cp .;<path to cucumber jar folder>/* io.cucumber.core.cli.Main --threads 4 -g parallel parallel

Hi, I am also facing similar issue. I have created feature file, Runner class, Step definition.

Yet I face the below errors due to the runWithCucumberRunner

import testClass.DummyClassMag
import com.cucumber.testrunner
CucumberKW.runWithCucumberRunner(DummyClassMag.class)

RunnerClass file name: DummyClassMag.java

package testClass;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features="Include/features/Test_Login.feature", glue="", tags="@RegressionTestMag", plugin={"pretty","html:target/cucumber-html-report","json:target/cucumber.json","pretty:target/cucumber-pretty.txt","junit:target/cucumber-results.xml"})

public class DummyClassMag {
}

hello @duyluong,
could you say me which cucumber version is included in katalon ?
I suspect katalon use an old version of cucumber libraries :
image

Is it possible to update io.cucumber.core version to a new one ?

I tried to use --threads option of v4.0.0 but I got error “cucumber.runtime.CucumberException: Unknown option: --threads”

=============== ROOT CAUSE =====================
Caused by: cucumber.runtime.CucumberException: Unknown option: --threads

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html
================================================

01-10-2022 02:10:52 PM Test Cases/Cucumber - FM Parallelised test - Launch Test

Elapsed time: 1,239s

Test Cases/Cucumber - FM Parallelised test - Launch Test FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Keyword runFeatureFile was failed (Root cause: cucumber.runtime.CucumberException: Unknown option: --threads
	at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:180)
	at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:112)
	at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:105)
	at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:97)
	at cucumber.api.cli.Main.run(Main.java:30)
	at cucumber.api.cli.Main$run.call(Unknown Source)
	at test.common.CucumberFmRunner$_runFmParallelFeatureFile_closure1.doCall(CucumberFmRunner.groovy:127)
	at test.common.CucumberFmRunner$_runFmParallelFeatureFile_closure1.doCall(CucumberFmRunner.groovy)
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:74)
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
	at test.common.CucumberFmRunner.runFmParallelFeatureFile(CucumberFmRunner.groovy:83)
	at test.common.CucumberFmRunner$runFmParallelFeatureFile.callStatic(Unknown Source)
	at test.common.CucumberFmRunner.runFmParallelFeatureFile(CucumberFmRunner.groovy:78)
	at Cucumber - FM Parallelised test - Launch Test.run(Cucumber - FM Parallelised test - Launch Test:9)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:442)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:433)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:412)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:404)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:281)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:138)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:129)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1641820250402.run(TempTestCase1641820250402.groovy:25)
)
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:76)
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
	at test.common.CucumberFmRunner.runFmParallelFeatureFile(CucumberFmRunner.groovy:83)
	at test.common.CucumberFmRunner$runFmParallelFeatureFile.callStatic(Unknown Source)
	at test.common.CucumberFmRunner.runFmParallelFeatureFile(CucumberFmRunner.groovy:78)
	at Cucumber - FM Parallelised test - Launch Test.run(Cucumber - FM Parallelised test - Launch Test:9)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:442)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:433)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:412)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:404)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:281)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:138)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:129)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1641820250402.run(TempTestCase1641820250402.groovy:25)
Caused by: cucumber.runtime.CucumberException: Unknown option: --threads
	at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:180)
	at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:112)
	at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:105)
	at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:97)
	at cucumber.api.cli.Main.run(Main.java:30)
	at cucumber.api.cli.Main$run.call(Unknown Source)
	at test.common.CucumberFmRunner$_runFmParallelFeatureFile_closure1.doCall(CucumberFmRunner.groovy:127)
	at test.common.CucumberFmRunner$_runFmParallelFeatureFile_closure1.doCall(CucumberFmRunner.groovy)
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:74)
	... 17 more

For information, I tried to rewrite CucumberKW.runFeatureFileWithTag function in order to add this “–threads” parameter but I am stucked at this error :

public class CucumberFmRunner extends BuiltinKeywords {
	
	private static final String CUCUMBER_PLATFORM_NAME = "cucumber";

	private static final KeywordLogger logger = KeywordLogger.getInstance(CucumberFmRunner.class);


	public static List GLUE = [""]

	/**
	 * Runs the given Feature file with <code>featureId</code> by invoking
	 * {@link cucumber.api.cli.Main#run(String[], ClassLoader)}.
	 * If your step definitions are in packages, you can set glue path to help system can detect your step definitions path easier.
	 * </p>
	 * The generated reports will be extracted in the current report folder with the following path: <code>&lt;report_folder&gt;/cucumber_report/&lt;current_time_stamp&gt;<code>
	 * </p>
	 *
	 * Examples:
	 * <ul>
	 * <li>Example #1: Run a single feature file
	 * <pre>
	 * import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
	 * import com.kms.katalon.core.model.FailureHandling
	 *
	 * CucumberKW.runFeatureFile('Include/features/New Feature File.feature', FailureHandling.STOP_ON_FAILURE)
	 * </pre>
	 * </li>
	 * <li>Example #2: Run a single feature file and the step definitions is in pre-defined packages
	 * <pre>
	 * import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
	 * import com.kms.katalon.core.model.FailureHandling
	 *
	 * CucumberKW.GLUE = ['mypackage1', 'mypackage2']
	 * CucumberKW.runFeatureFile('Include/features/New Feature File.feature', FailureHandling.STOP_ON_FAILURE)
	 * </pre>
	 * </li>
	 * </ul>
	 *
	 * @param relativeFilePath
	 * relativeFilePath of Feature file
	 * @param flowControl
	 * an instance {@link FailureHandling} that controls the running flow
	 * @return
	 * an instance of {@link CucumberRunnerResult} that includes status of keyword and report folder location.
	 *
	 * @since 5.7
	 * @see CucumberRunnerResult
	 */
	
	@Keyword
	public static CucumberRunnerResult runFmParallelFeatureFile(int threadNumber, String relativeFilePath,  String[] tags) {
		return runFmParallelFeatureFile(threadNumber, relativeFilePath, tags, RunConfiguration.getDefaultFailureHandling());
	}
	
	@Keyword
	public static CucumberRunnerResult runFmParallelFeatureFile(int threadNumber, String relativeFilePath,  String[] tags, FailureHandling flowControl) {
		return KeywordMain.runKeyword(CUCUMBER_PLATFORM_NAME, {
			if (StringUtils.isEmpty(relativeFilePath)) {
				throw new IllegalArgumentException("relativeFilePath param must not be null or empty")
			}
			String reportDir = RunConfiguration.getReportFolder() + "/cucumber_report/" + System.currentTimeMillis()
			String projectDir = RunConfiguration.getProjectDir()
			RunningMode runningMode = RunConfiguration.getRunningMode()

			logger.logInfo(
					MessageFormat.format("Starting run keyword runFeatureFile: ''{0}'' and extract report to folder: ''{1}''...",
					relativeFilePath, reportDir))
			logger.logDebug('Glue: ' + GLUE)
			
			String[] argv = []
			for (g in GLUE) {
				argv += ['-g', g]
			}
			argv += [
				projectDir + "/" + relativeFilePath,
				"--strict",
				//                "--plugin",
				//                "pretty",
				"--plugin",
				"html:" + reportDir + "/html",
				"--plugin",
				"json:" + reportDir + "/cucumber.json",
				"--plugin",
				"junit:"+ reportDir + "/cucumber.xml",
				"--plugin",
				CucumberReporter.class.getName() + ":" + reportDir + "/k-cucumber.json"
			]
			if (tags != null) {
				for (String tag in tags) {
					argv = argv + ["--tags"]
					argv = argv + tag
				}
			}
			//TODO : https://cucumber.io/docs/guides/parallel-execution/
			argv = argv + ["--threads",threadNumber]
			
			if (runningMode == RunningMode.CONSOLE) {
				argv = argv + ["--monochrome"]
			}
			println "argv : $argv"
			boolean runSuccess = Main.run(argv, CucumberFmRunner.class.getClassLoader()) == 0;
			CucumberRunnerResultImpl cucumberResult = new CucumberRunnerResultImpl(
					runSuccess ? 'passed' : 'failed', reportDir)
			if (runSuccess) {
				logger.logPassed(MessageFormat.format("Feature file: ''{0}'' was passed", relativeFilePath));
			} else {
				KeywordMain.stepFailed(MessageFormat.format("Feature file ''{0}'' was failed", relativeFilePath), flowControl)
			}
			return cucumberResult;
		}, flowControl, "Keyword runFeatureFile was failed");
	}

}

Hey @staniere , I am facing an issue with Cucumber keywords as they are not available in Katalon 8.2.5 version. can you suggest what would be the best solution ?
A. Reinstall the Katalon Studio to lower version or something ?
B. Reinstall the cucumber jar or anything ?
C. Update any config detail and make it work ?

Appreciate your reply.

hello @magesh.mariappan,
I have no solution for the moment (always got an old cucumber version integrated in katalon).

I opened a ticket in katalon support and they said they will look at upgrading cucumber version in the future

for your problem, I have no idea sorry

@magesh.mariappan
@staniere

Have a look at

Please pay attention to

Exclude built-in libraries

With the ability to remove built-in libraries stored in the .classpath file of a project folder, you can replace a built-in library with an external one for flexible libraries usage in a test project.

Important
This feature applies to all libraries in classpath , excluding:

  • io.cucumber.*.jar

Excluding those libraries may cause failure of the relevant features.

As you see, Katalon suggest to users not to try upgrading the io.cucumber.*.jar.

But you could try it and see what happens.

If you are going to try upgrading the cucumber-core-*.jar, you need to know

  1. which old built-in jar you need to remove out of the .classpath file
  2. which new version of jars you should copy into the Drivers folder

Here I assume you are sure you want the cucumber-core-5.7.0.jar. Then what else? The cucumber-core-5.7.0.jar would depend on other cucumber-something-x.x.x.jar so that you need to upgrade them at the same time. Unfortunately Katalon Studio provides no help to diagnose the dependency tree.

I would show you how to retrieve the dependency tree.

First you need to install Gradle into your machine. You need to be able to do the following operation in the command line:

$ gradle -version

------------------------------------------------------------
Gradle x.x.x
------------------------------------------------------------

Change the <projectDir>/build.gradle file as follows:

ext {
  AUTO_IMPORTED_JAR_PREFIX = 'AUTOIMPORTED_'
}

repositories {
  mavenCentral()
  mavenLocal()
}

configurations {
  myconf
}

dependencies {
	// https://mvnrepository.com/artifact/io.cucumber/cucumber-core
	//myconf group: 'io.cucumber', name: 'cucumber-core', version: '7.2.3'
    myconf group: 'io.cucumber', name: 'cucumber-core', version: '5.7.0'

}

task drivers {
    doFirst {
        delete fileTree("Drivers") {
            include("**/" + AUTO_IMPORTED_JAR_PREFIX + "*")
        }
    }
    doLast {
        copy { copySpec ->
            copySpec
                .from(project.getConfigurations().getByName("myconf"))
                .into("Drivers")
                .include(
                    "**/cucumber*.jar",
                    )
                .rename({ s ->
                    AUTO_IMPORTED_JAR_PREFIX + s
                    })
        }
    }
}

Then in the command line you want to run the following command:

$ cd <projectDir>
$ gradle dependencies

> Task :dependencies

------------------------------------------------------------
Root project 'KS_upgrading_cucumber_jars'
------------------------------------------------------------

myconf
\--- io.cucumber:cucumber-core:5.7.0
     +--- io.cucumber:cucumber-gherkin:5.7.0
     |    \--- io.cucumber:cucumber-plugin:5.7.0
     |         \--- org.apiguardian:apiguardian-api:1.1.0
     +--- io.cucumber:cucumber-gherkin-vintage:5.7.0
     |    \--- io.cucumber:cucumber-gherkin:5.7.0 (*)
     +--- io.cucumber:tag-expressions:2.0.4
     +--- io.cucumber:cucumber-expressions:8.3.1
     |    \--- org.apiguardian:apiguardian-api:1.1.0
     +--- io.cucumber:datatable:3.3.1
     |    \--- org.apiguardian:apiguardian-api:1.1.0
     +--- io.cucumber:cucumber-plugin:5.7.0 (*)
     +--- io.cucumber:docstring:5.7.0
     |    \--- org.apiguardian:apiguardian-api:1.1.0
     \--- org.apiguardian:apiguardian-api:1.1.0

(*) - dependencies omitted (listed previously)

As you see Gradle tells you the dependency tree of cucumber-core.0.5.7.jar.

I found that cucumber5.7.0 depends on org.apiguardian:apiguardian-api. Is it built-in KS? I am not sure.

You can try

$ gradle drivers

Then you will find several jar files are copied into the Drivers folder.

$ ls Drivers
AUTOIMPORTED_cucumber-core-5.7.0.jar
AUTOIMPORTED_cucumber-expressions-8.3.1.jar
AUTOIMPORTED_cucumber-gherkin-5.7.0.jar
AUTOIMPORTED_cucumber-gherkin-vintage-5.7.0.jar
AUTOIMPORTED_cucumber-plugin-5.7.0.jar

Now you have got 5 jars in the Drivers folder.

Finally, you have one more setup task to do. You want to follow the instruction at the doc, you should exclude the built-in 5 jars of old version built-in Katalon Studio.

You want to stop KS once, and restart it so that it acknowledges the newer jars prepared in the Drivers folder.


Please be warned that it is quite likely that upgrading cucumber-core causes error. It is quite possible that some code of Katalon Studio depends on the Cucumber API of v3.x, or some code of Katalon Studio does not understand the Cucumber API of v5.x. In that case, you should just give it up.

I found that KS v8.2.5 does not include the jar of org.apiguardian. Therefore you need to add it in the Drivers folder as well.

Please replace the build.gradle as follows`.

ext {
  AUTO_IMPORTED_JAR_PREFIX = 'AUTOIMPORTED_'
}

repositories {
  mavenCentral()
  mavenLocal()
}

configurations {
  myconf
}

dependencies {
	// https://mvnrepository.com/artifact/io.cucumber/cucumber-core
	//myconf group: 'io.cucumber', name: 'cucumber-core', version: '7.2.3'
    myconf group: 'io.cucumber', name: 'cucumber-core', version: '5.7.0'
    
    // https://mvnrepository.com/artifact/org.apiguardian/apiguardian-api
    myconf group: 'org.apiguardian', name: 'apiguardian-api', version: '1.1.0'

}

task drivers {
    doFirst {
        delete fileTree("Drivers") {
            include("**/" + AUTO_IMPORTED_JAR_PREFIX + "*")
        }
    }
    doLast {
        copy { copySpec ->
            copySpec
                .from(project.getConfigurations().getByName("myconf"))
                .into("Drivers")
                .include(
                    "**/cucumber*.jar",
                    "**/apiguardian-api*.jar"
                    )
                .rename({ s ->
                    AUTO_IMPORTED_JAR_PREFIX + s
                    })
        }
    }
}

@kazurayam - How are you passing Cucumber tags at runtime when using the Cucumber runner?

It looks like global variables aren’t supported inside of a groovy class.

The internal.GlobalVariable object is public. It is available for any groovy classes inside KS. If you find your class can’t get it, I guess your code has some mistakes. But you haven’t showed your code, logs, etc. So I do not see anything.

Please create a new post for your problem if you are going to raise a question.