NHP95 / Cucumber-Katalon-Trick

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass in Cucumber tags at runtime when execute tests using a custom runner class

By default, Katalon doesn't allow users to pass in tags at runtime (e.g. using GlobalVariable) WHEN a custom runner class is used. However, it could be overcome by overriding the CucumberOptions annotation of the runner class. Below is a Test Case illustrating how one can use the provided overrider.

/*
 * This line should be put in a hook (e.g. beforeTestCase, beforeTestSuite).
 */
new CucumberOptionsOverrider(MyRunner.class).tags(GlobalVariable.TAGS).override()
/*
 * or
 * new CucumberOptionsOverrider(MyRunner.class).tags(["@yourtags"]).override()
 */

CucumberKW.runWithCucumberRunner(MyRunner.class)

About


Languages

Language:Groovy 91.5%Language:Gherkin 8.5%