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.
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 you time when you have many tags to manage.
Go to Tests Explorer -> Profiles to open your desired profiles. Click Add to create a global variable whose 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)Note:
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).