Passing feature file and scenario tags at runtime when building with Jenkins
When running automated tests, you might want to classify different features and scenarios into different tags for better management.
This tutorial will guide you through how to set your scenario tags to be executed at runtime when Jenkins Build triggers your tests.
- Jenkins is already installed. See Jenkins documentation on Installing Jenkins.
- Katalon TestOps plugin is already installed on Jenkins. See How to use Katalon TestOps plugin for Jenkins on Windows.
- An active Katalon Runtime Engine license.
Create Global Variables
You can change Global Variable values in a Test Suite during runtime without affecting other Test Suites. Therefore, using a Global Variable as a parameter in the keyword
runFeatureFolderWithTags can save your time when you have many tags to manage.
In the Tests Explorer, go to Profiles to open your desired Profiles. Click Add to create a Global Variable which values are tags. See Global Variables.
Write a test case with the following keyword:
- folderRelativePath: the folder relative path that starts from the current project location.
- tags: the Global Variable defined in step 1.
CucumberKW.runFeatureFolderWithTags('Include/features/BDD Cucumber Tests', GlobalVariable.username)
To learn more about this keyword, see [Cucumber] Run Feature Folder with Tags.
Add this test case to a test suite and execute it from Jenkins. With the Global Variable created, you can choose which feature files folder to run with your desired tags values.
Update Global Variables during runtime
To change the Global Variable by your desired scenario tags during runtime, use the following command syntax
-g_XXX, for example,
Read more about running Cucumber feature files at BDD Testing Framework (Cucumber integration).